Tag Archives: Application software

ffmpeg, libx264 and presets

When working with FFMPEG you can convert/encode in various formats, but in my case this should be an MP4 file, encoded with libx264. This combination is quite well known in the web community, because those videos are playable under almost any flash player and Apple products.

Now the problem is that this comes with very large list of options, which are difficult to setup, especially for newbies like me. Than everything’s difficult, once because the resulting quality is not always the same as the input file’s quality.

The Solution

Is to use presets. Thankfully ffmpeg with libx264 can be used with presets, i.e. NORMAL, HD etc. which means that you don’t have to setup a command by hand and the resulting quality is the same as the input quality.

Here’s a sample command using normal preset:

ffmpeg -i source.mp4 -acodec libfaac -ab 128k -ac 2 -vcodec libx264 -vpre normal -threads 0 -crf 22 output.mp4

here the source can be either mp4 or some other file format as FLV for instance.

Video sites must use … mp4 and only mp4!

H.264

Yes it may sound strange, but now with the upcoming HTML5 features every browser again is playing its own game. Firefox and Opera support only OGG Theora, Chrome and Safari only MP4 and what about IE .. it doesn’t support anything. Than why should we convert to mp4 with h.264 codec?

Because everybody is playing flash

And that’s again very sad but at least the flash players are playing mp4 with this encoding, which is good because this file will be playable under most of the mobiles. And if you have a large video site to support why don’t you convert to mp4 and play it with a Flash Player and give the opportunity to play mp4 on mobile.

Only one file under the sky

Thus you gain to keep only one file – playable under every device?

YouTube and FLV

Now I wonder why YouTube have both FLV and MP4 formats?

Of course if you’d like to be perfect …

Convert every video to MP4, FLV and OGG, but that means 3 files for every video?!