An Open Access Peon

07 September 2009

Generating Flash Video (FLV) using FFMpeg

I encountered a problem generating Flash Video (.flv) format files using the latest versions of ffmpeg and libmp3lame. The generated files didn't contain a duration so wouldn't play nicely in the FLV Player embedded player (the player would buffer and play the 5 seconds buffer then stop).

After some investigation I found the problem was due to a buffer error with the libmp3lame library that, while it didn't stop a file being generated, prevented ffmpeg embedding the duration in the flv output. Here's a bug entry for Ubuntu but the OP erronously claims the encoding succeeds - it does to a degree, but any post-encoding operations by ffmpeg won't happen (setting the duration for FLV happens after the encoding).

After much fruitless time trying to fix the broken lame library I used the AAC codec instead:

ffmpeg -i FOO.MPG -acodec aac FOO.FLV