Tuesday, 19 June 2012

Converting flv to mp4

Recently, I had the need to convert a number of flash movies into mp4. I had some issues with the time needed for this operation, while using ffmpeg for this. A quick search revealed this tip:

http://www.learnosity.com/techblog/index.cfm/2010/12/29/Convert-FLV-to-MP4-with-ffmpeg-Howto

I recently needed to convert a lot of FLV files which were H264 encoded to MP4 so that they would play nice on my Mac Mini.
Initial attempts using ffmpeg were making it re-encode the entire video which would take ages and result in a larger file or worse quality.

The Solution

ffmpeg -i input.flv -vcodec copy -acodec copy output.mp4

The final comments included a question about converting multiple files but the answer did not fulfill my needs, because I had files inside a directory tree.

So I ended doing this to find all flv files and perform a quick conversion, overwriting existent files:

for file in $(find . -type f -iname *.flv -print); do \
ffmpeg -i $file -y -vcodec copy -acodec copy ${file%%.flv}.mp4; done


No comments:

Post a Comment