Configure Libtheora Quality in FFmpeg
This article provides a quick and direct guide on how to configure
the video quality parameter for the libtheora encoder in
FFmpeg. You will learn the specific command-line options used to control
output quality, the range of valid quality values, and see practical
examples of how to apply these settings to your video transcodings.
The libtheora encoder in FFmpeg uses a quality-based
variable bitrate (VBR) scale to control video compression. The primary
parameter used to adjust this quality is -qscale:v (which
can also be written as -q:v or simply -q).
The Quality Scale Range
- Value Range:
0to10 - Highest Quality:
10(results in the largest file size) - Lowest Quality:
0(results in the smallest file size) - Recommended Range:
5to7(offers the best balance between visual quality and file size for most standard videos)
Basic Command Syntax
To set the video quality with libtheora, pass the
-q:v option followed by your desired value between 0 and
10. Here is a basic command example:
ffmpeg -i input.mp4 -c:v libtheora -q:v 6 output.ogvIn this command: * -i input.mp4 specifies the input
video file. * -c:v libtheora selects the Theora video
encoder. * -q:v 6 sets the video quality level to 6. *
output.ogv is the resulting Ogg Video file.
Adding Audio Quality
Because Theora video is almost always multiplexed with Vorbis audio
in an Ogg container, you should also configure the audio quality using
the -q:a parameter (which also ranges from -1
to 10 with 10 being the highest quality):
ffmpeg -i input.mp4 -c:v libtheora -q:v 6 -c:a libvorbis -q:a 4 output.ogvBy utilizing the -q:v scale, FFmpeg dynamically
allocates bitrate to maintain consistent visual quality throughout the
duration of the video.