Interesting Tech Projects
Posts tagged ffmpeg
You Tube, H.264, High Definition and FFmpeg
Jun 3rd
Recently I had the need to take a set of jpeg images and convert them into a high definition time lapse video, then upload to You Tube. Easier said than done…
To get the best quality I wanted to use H.264/MP4, which is also recommended by You Tube. I also wanted 1080P. The problem is that You Tube doesn’t seem to like B-frames in the file, and messes up the start of videos. So here is the solution I found.
Firstly I needed to upgrade my Debian server to Squeeze.
Next I compiled x264 and FFmpeg as described in How To Build FFmpeg on Debian Squeeze.
Finally I ran the following FFmpeg command line to generate a time lapse video at 24 frames per second (-r 24), using 1080P (-s hd1080) with no B-frames (-bf 0):
ffmpeg -r 24 -i %04d.jpg -s hd1080 -vcodec libx264 -vpre hq -bf 0 -crf 16 myfile.mp4
It’s important that the frame rate is specified before the input source in order to make FFmpeg apply the frame rate to the source. Note that trying to use qt-faststart causes You Tube to complain about the audio, even though there isn’t any audio.