Linux – How to use ffmpeg ffpreset files


My ffmpeg comes with some ffpreset files:

$ ls /usr/share/ffmpeg
libvpx-1080p.ffpreset       libvpx-360p.ffpreset  libvpx-720p50_60.ffpreset
libvpx-1080p50_60.ffpreset  libvpx-720p.ffpreset

I'm wondering how can I use them, i.e., specifying different preset files from the command line, and if I can customize them at all?

In, it says,

For "using preset files, enable the -vpre option after declaring the desired -vcodec". I don't quite understand what it is saying, and what exactly to do.

But somewhere above it, at, using the preset is like this instead:

ffmpeg -i input -c:v libx265 -aspect 1920:1080 -preset veryslow -x265-params crf 20 output

Where can I find the meaning of this veryslow, and other similar options as such?


Best Answer

  • Instead of reading the Arch Wiki, rather check the ffmpeg documentation on the preset options. All should be explained there.

    Note that there are three different kinds of presets:

    • .ffpreset files: You define option=value pairs in those files and for video settings you generally use them with -vpre. Depending on the encoder you select, ffmpeg will then search for a matching ffpreset file. For example, if you set -vcodec libvpx (or -c:v libvpx), and -vpre 1080p, then ffmpeg will load the libvpx-1080p.ffpreset file.

      You can also, more generally, use -pre and specify vcodec=libvpx as an option/value pair in the .ffpreset file. This allows you to set video and audio encoders at the same time. For example, you simply call -pre custom, and ffmpeg will load the custom.ffpreset file.

    • .avpreset files: work similar to -vpre or -apre presets — those are mostly for compatibility with Libav.

    • x264 presets: x264 is an H.264 encoder (used in ffmpeg with -c:v libx264). It has several presets which basically control the speed of the encoder in inverse relation to the quality or efficiency of the encoding process. Those presets have nothing to do with ffmpeg's presets, and they're called with the -preset option. They have names like ultrafast, superfast, veryfast, faster, fast, medium, slow, slower or veryslow. Read the H.264 encoding guide for more about that, or call x264 --fullhelp for the preset description.