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


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 deprecated 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 the 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 allow 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 the 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.

  • What should I do to reduce the chances of Conversion Fail, it's happening at random, sometimes it doesnát happen
    – FlyingAtom
    Nov 8 '16 at 4:40
  • @FlyingAtom I haven't heard of "Conversion Fail" yet. If you have a specific question with a reproducible problem, please ask a new question: superuser.com/questions/ask
    – slhck
    Nov 8 '16 at 9:30
  • So what would you effectively end up with if all you supplied was ffmpeg -i input.mp4 -c:v libx264 output.mp4? crf:23 and preset:medium? Nov 19 '16 at 7:55
  • 1
    @Drazen Yes, that's right.
    – slhck
    Nov 21 '16 at 5:53
  • Cheers! ------- Dec 2 '16 at 1:43

I did a test in which I trans-coded (using libx264 encoding to .mp4) a high quality video from a Sony camcorder using the full range of preset values (except placebo) on a range of CRF values (18, 21, 24, and 27). I wanted to know what would give me the best combination of encoding speed, output quality and file size.

For each CRF value, I gave each trans-code operation a score for its encode time (e.g., for CRF = 18, preset value ultrafast's time of 5.7 seconds got a score of 1.0, veryslow's time of 162 seconds got a 0, with all other scores scaled in between). I calculated output file size scores similarly, of course giving the smallest file the best score. I then added the two scores for a "combined" speed/size score.

For each of the four CRF values, the "veryfast" preset was the hands-down winner, with nearly perfect scores of 1.94 (for CRF 18 and 21), 1.96 (CRF 24) and 1.97 (CRF 27). I find it very curious that "veryfast" produced nearly the smallest file size every time, losing only to "veryslow" and never by much.

One difference I did notice among the various preset values was that the operating system (Windows 7) would give me different thumbnails. The faster presets would show a thumbnail several seconds into the video, where the thumbnails for the slower presets would reflect the opening frame(s) of the video. That's not important for me; what I learned was that "-preset veryfast" seems to be an easy choice.

Here are my results (as a snapshot image of an Excel spreadsheet):
excel snapshot

Here is the Excel spreadsheet as csv text:

  • 3
    I know Super User’s formatting options are mediocre, but it might be helpful if you posted the data as text — possibly using code formatting.
    – Scott
    Oct 14 '17 at 19:37
  • 1
    Fascinating. It is also faster on my machine. Thanks! Oct 14 '18 at 11:11
  • 1
    I must admit that I looked on your results with suspicion, but I've repeated the test and got v. similar results, using ffmpeg version 3.3.2-1 on a 2 min 1080p movie clip. In fact veryfast generated the smallest file size 60% of the time, and coming 2nd to veryslow 40% of the time (but not by much). From now on I'll be using veryfast for all my encodes along with a fairly low CRF value (18, 19, 20) since veryfast was only a little slower with the lower CRF values than it was with the higher ones. Thanks you've saved me lots of time. Raw data and script in comment below.
    – mattst
    Nov 9 '18 at 17:22
  • 1
    Continuing from the comment above... Here's my raw data - CRFs 18 to 27 and the Linux/UNIX bash script that I wrote to run the encodes (in case anyone wishes to run a similar test).
    – mattst
    Nov 9 '18 at 17:25
  • 2
    Here are some great blog posts on the subjects, with tests conducted for x264 and x265 (results are, predictably, very different for each) Feb 20 '19 at 6:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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