VP9 encoding with FFmpeg: relation between -speed and -deadline options

Solution 1:

-speed is the same as -cpu-used

FFmpeg source code (libavcodec/libvpxenc.c) shows that -speed is a legacy alias for -cpu_used.

Use both -deadline and -cpu-used to control speed

-deadline has 3 modes: best, good, and rt. The -cpu-used option can tweak each mode to further adjust speed. The meaning/value of -cpu-used depends on the mode.

  • best - This usually gives the best quality output but is extremely slow. In general this is not a recommended setting unless you have a lot of time on your hands.

  • good - This is the default value if you don't set -deadline. This will be what most users should use most of the time. Within the scope of "good" quality there are 6 further speed steps that are set through the -cpu-used parameter (values from 0 to 5).

    • Setting -cpu-used 0 will give quality that is usually very close to and even sometimes better than that obtained with -deadline best, but the encoder will typically run about twice as fast.

    • Setting -cpu-used 1 or -cpu-used 2 will give further significant boosts to encode speed, but will start to have a more noticeable impact on quality and may also start to effect the accuracy of the data rate control.

    • Setting a value of 4 or 5 will turn off "rate distortion optimisation" which has a big impact on quality, but also greatly speeds up the encoder.

  • rt - Real-time mode allows the encoder to auto adjust the speed vs. quality trade-off in order to try and hit a particular cpu utilisation target. In this mode the -cpu-used parameter controls the %cpu target as follows:

    target cpu utilisation = (100*(16-cpu-used)/16)%
    

    Legal values for -cpu-used when combined with -deadline rt are (0-15). It is worth noting that in real-time mode the encode quality will depend on how hard a particular clip or section of a clip is and how fast the encoding machine is. In this mode the results will thus vary from machine to machine and even from run to run depending on what else you are doing.

Source: The WebM Project | VP8 Encode Parameter Guide. Should apply to VP9 as well.

Note that -quality is a legacy alias for -deadline.