Configure Ogg Vorbis Quality Scale in FFmpeg
This article provides a quick guide on how to configure the audio
quality scale (-aq) when encoding Ogg Vorbis audio using
FFmpeg. You will learn how the quality scale works, the range of values
you can use, and practical FFmpeg commands to achieve your desired audio
bitrate and quality.
To configure the quality of an Ogg Vorbis audio stream in FFmpeg, you
use the -aq (audio quality) flag in combination with the
libvorbis encoder. The -aq flag enables
variable bitrate (VBR) encoding, which optimizes the file size by
allocating more data to complex audio segments and less data to simpler
ones.
The Vorbis Quality Scale
The -aq scale for the libvorbis encoder
ranges from -1.0 to 10.0.
-1.0: Lowest quality (approximately 45 kbps)3.0: Medium quality (approximately 112 kbps, good for general use)6.0: High quality (approximately 192 kbps, recommended for music)10.0: Highest quality (approximately 500 kbps)
Each increase of 1.0 on the scale roughly corresponds to an increase in audio fidelity and file size.
Basic Command Syntax
To encode an audio file to Ogg Vorbis with a specific quality setting, use the following command structure:
ffmpeg -i input.wav -c:a libvorbis -aq 5 output.oggCommand Breakdown: * -i input.wav:
Specifies the input file. * -c:a libvorbis: Selects the
Vorbis encoder. * -aq 5: Sets the quality scale to
5 (roughly 160 kbps). * output.ogg: Specifies
the output file name and container.
Recommended Quality Settings
Depending on your use case, here are the recommended -aq
values:
| Quality Level | -aq Value |
Target Bitrate | Ideal Use Case |
|---|---|---|---|
| Low | 1 |
~80 kbps | Voice recordings, podcasts |
| Medium | 3 to 4 |
~112 - 128 kbps | Standard streaming, web audio |
| High | 5 to 6 |
~160 - 192 kbps | High-fidelity music playback |
| Very High | 8 |
~256 kbps | Archiving, high-end audio setups |
By using the -aq flag instead of forcing a constant
bitrate (-b:a), FFmpeg ensures the most efficient use of
disk space while maintaining consistent acoustic quality throughout the
duration of the audio track.