Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ffmpeg VP9 - What do the quality settings change?

Tags:

ffmpeg

libvpx

ffmpeg has a -quality setting when encoding VP9 with options best, good, and realtime. How do these options affect the other available encoding options (ex. -speed, -slices, -frame-parallel, etc...)? I read somewhere that -best and -good -speed 0 will give about the same quality, with the later being much faster. To me this makes it sound like the quality settings just change the other options (such as -speed) as if they are merely presets and one could achieve the same results manually. Is this true, or do the quality settings affect things I couldn't change with other options?

like image 567
Yay295 Avatar asked Mar 15 '23 22:03

Yay295


1 Answers

After some more searching online and some digging in the libvpx code, I think I have figured it out. It seems that the ffmpeg -quality command is the same as the -deadline command. These commands do not directly affect the other options, but merely determine the amount of time the encoder is allowed to spend on any particular frame. As commented in the vpx_encoder.h file in the libvpx code:

The encoder supports the notion of a soft real-time deadline. Given a non-zero value to the deadline parameter, the encoder will make a "best effort" guarantee to return before the given time slice expires. It is implicit that limiting the available time to encode will degrade the output quality. The encoder can be given an unlimited time to produce the best possible frame by specifying a deadline of '0'. This deadline supercedes the VPx notion of "best quality, good quality, realtime". Applications that wish to map these former settings to the new deadline based system can use the symbols #VPX_DL_REALTIME, #VPX_DL_GOOD_QUALITY, and #VPX_DL_BEST_QUALITY.

The values for the preset qualities are defined in this file as:

- BEST     =       0 Microseconds = Infinite
- GOOD     = 1000000 Microseconds = 1 Second
- REALTIME =       1 Microsecond

The default setting is Best.

like image 133
Yay295 Avatar answered Mar 24 '23 15:03

Yay295