Home

Awesome

flv.js, flv demuxer in javascript

Largely inspired by the flv demuxer from ffmpeg ( ffmpeg/libavformat/flvdec.c ).

Testing

For testing the demuxer, you need a copy of ffmpeg, see the instruction here: http://ffmpeg.org/download.html.

Maybe you can go without building your copy. For example, on a debian-like system, you install the following:

sudo aptitude install libavformat-dev libavfilter-dev libavdevice-dev libavcodec-dev libavutil-dev

This directly installs the ffmpeg libraries that would have been built. Otherwise, just build it.

Then, go in the ffmpeg directory, and run:

patch -p1 < pktdumper-output.patch
gcc -I. -I.. tools/pktdumper.c -lavformat -lavfilter -lavdevice -lavcodec -lavutil  -lavutil -o ~/bin/pktdumper

to build the packet dumper utility. You might want to adjust the output location (after the -o option). We consider ffmpeg a reference implementation. The test consists in comparing what we dump using flv.js an ffmpeg. We assume that if we can extract the same packet, the demuxing is correct.

When you've made sure that pktdumper is in your PATH environment variable, just run test.sh. This essentially dump the packets using ffmpeg and flv.js, in two separate directory, but with the same names, using the little patch above. Then diff is ran on those directories. If flv.js did its job correctly, the only difference should be a metadata file in the directory where flv.js dumped the packets, that contains the metadata of this flv file.