mardi 25 mars 2008

ffmpeg : png to 3gp

ffmpeg. What a fantastic tool... but so many command line options.....

For the renderer project, ffmpeg is currently used to create the 3gp files with the generated video that is the output bitmap from the markup rendering. Longer term, this can/should be done using the ffmpeg api directly from the bitmap. Short term, I just generate a PNG file, and transform it into a 2s video clip in 3gp container format with h.263 codec.

But: when creating 3gp files, its important to note that if you want to play them on a 3G phone over the mobile waves, you have to watch a whole lot of parameters to ensure that the bit rate and buffering don't make it break.....

For humanity, here's a note of the good command line to convert a PNG into a 3GP that will actually work.... Anyway, currently I'm using:

ffmpeg -i input.png -s 176x144 -i_qfactor 10 -qscale 8 -b_qfactor 6 -ps 128 -bufsize 80000 -intra -b 40000 -vcodec h263 -y -an -r 0.5 -t 2 -loop_input -f 3gp output.3gp

However, I'm not sure this is too good for 2 reasons:
1/ it converts a <1K PNG file (at 176x144 QCIF) into a 3-4K 3gp file (which should contain only 1 intra frame which is the same image!!)
2/ the 3gp file seems to take about 4s to get from the media server to the phone....

Aucun commentaire: