Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Have tried a number of 'cheat sheets' available elsewhere but they almost all are out of date and simply will NOT work with the latest version of FFMpeg.

Can anyone point me to settings that WILL work with the latest FFMpeg?

I'm primarily interested in the following codecs

H.264, low medium and high quality presets

as well as

ProRes, low medium and high quality presets

share|improve this question
add comment

1 Answer

up vote 7 down vote accepted

FFmpeg does not include text file based presets and profiles anymore for libx264, i.e. what you've used with the -vpre option. These have been depreciated and removed in favor of accessing the actual x264 presets, profiles (and tunes) with the -preset, -profile:v, and -tune options. The old text files only emulated the official x264 presets and profiles, and due to several limitations could not offer full functionality that the new system provides. It is also much easier to maintain.

Additionally, many encoders have their own separate options; also called "private options". You will have to look into the audio and video encoder options for common codecs in the FFmpeg online documentation, or check the output of ffmpeg -h full for a complete list of supported options. For example, x264 lists its options under libx264 AVOptions in the full help output.

If your ffmpeg supports -preset then any text file presets should not be used, and FFmpeg no longer comes with any other than some non-standard iPod presets. It is a common misconception that text presets can simply be copied from anywhere and used with any ffmpeg. This is untrue and will result in breakage.


Basically, the presets allowed you to do the following things:

Control quality

Quality is controlled either by specifying a bitrate through -b:v (for video) or -b:a (for audio), or by specifying any other encoding method the codec might support.

For x264, there are various encoding methods, with the Constant Rate Factor method being the most sophisticated. It results in variable bitrate, but overall good quality in one single pass. CRF values range from 0 to 51, but sane values are somewhere between 19 and 26, depending on your source and what quality you want. 23 is default, so you could for example choose 18 for "high quality" and 28 for "low quality", whatever that means for you.

ffmpeg -i input.mp4 -c:v libx264 -crf 23 output.mp4

x264 has other encoding methods as well, but this is out of the scope here.

Constrain the H.264 profile

These profiles define a feature set the encoder may use to match the capabilities of a certain decoder. In recent FFmpeg, use the following syntax to specify a profile, where profile could be baseline, main or high:

ffmpeg -i input.mp4 -c:v libx264 -profile:v baseline output.mp4

For more info and when you should use which profile, see: What are the differences between H.264 Profiles?

Choose an x264 encoding preset

These presets affect the encoding speed. Using a slower preset gives you better compression, or quality per filesize, whereas faster presets give you worse compression. In general, you should just use the preset you can afford to wait for. Presets can be ultrafast, superfast, veryfast, faster, fast, medium (default), slow and veryslow. Here's an example:

ffmpeg -i input.mp4 -c:v libx264 -preset slow output.mp4

Encode lossless video

This is possible by specifying a CRF of 0, so simply use -crf 0:

ffmpeg -i input.mp4 -c:v libx264 -crf 0 output.mp4

Finally, let's talk about ProRes quickly. ProRes accepts either a fixed bitrate with -b:v, or you can specify the profile, which should be a value between 0 and 3, where the bit rates are chosen according to the profile. Higher means better:

ffmpeg -i input.mp4 -c:v prores -profile:v 0 output.mov

The ffmbc Wiki suggests that names of profiles can be used – this however fails in FFmpeg 1.0.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.