Miscellaneous‎ > ‎hz‎ > ‎

Notes

These are my (William's) notes on the use of hz.

For the audio it does not take mp4/m4a. Need to extract it to raw ADTS AAC. MP4Box can do this. The livejournal post recommends using MPEG4IP but I can't find the appropriate program to run. Probably didn't look hard enough.

MP4Box -out output.aac -raw 1 source.mp4

The 1 there is the track ID. From what I've seen of the Nero AAC encoder output it is commonly 1 but you can check using:

MP4Box -info source.mp4

For Debian, MP4Box is in package gpac. Add the debian-multimedia repo to access it.

If you are testing hz with internal (not lua) playlist, it will get stuck if there is only one file in the playlist. Must have at least two different files in there. If there is only one file then the "never repeat previous file" logic gets confused.

The cuefile format (ref cuesheet.pas):

FILE "filename-ignored" WAVE
  TRACK 01 AUDIO
    TITLE "title"
    PERFORMER "performer"
    INDEX 01 00:00:00

Compiling did not work straight away using the freepascal on squeeze (v 2.4.0). Problems and solutions below:
  • sockets unit functions renamed to fp* e.g. Connect becomes fpConnect, Send becomes fpSend. Also some var/const parameters have been changed to take pointers instead. A patch is attached below.
  • lua library name on Debian is liblua5.1.so so the LuaDLL constant in luapas.pas needs to be changed from 'lua' to 'lua5.1'.
It turns out grabbing frames from an MP4 file isn't that difficult using libmp4v2. I've successfully grabbed some frames and stuck ADTS headers in front of them. Byte-for-byte identical with the MP4Box output. It is only a small step from this to sending them over the network. 

Problems: 
  • libshout's architecture seems to think it can determine the timing info from the stream alone. This is probably true if the stream is sent using ADTS headers. Just need to adapt the MP3 code a bit. The sync bits are even the same!
  • For the client, ezstream thinks that just pumping the file in chunks to libshout will work. This is not the case with MP4 encapsulated AAC stream where we have to create our own ADTS headers. 
  • However, ezstream supports encoder/decoder pairs.  If we create an MP4 -> ADTS AAC decoder it would be possible. Might need some adaptation in libshout for the timing bits.
  • Ices is a bit too tied to the encoder. If using ices might as well use ices0 instead of ices2. It would not support reencoding so we can rip out all HAVE_LIBLAME defines.

Ref:
ċ
net.pas.patch
(1k)
William Shallum,
May 1, 2011, 8:49 AM
Comments