Configure MPEG4 Encoder Quality in FFmpeg
This guide explains how to configure the quality parameter for the
native mpeg4 video encoder in FFmpeg. You will learn how to
use the constant quality scale parameter, understand its value ranges,
and see practical command-line examples to balance video quality and
file size.
To control the quality of the native FFmpeg MPEG-4 video encoder
(-c:v mpeg4), you should use the -qscale:v
option (often abbreviated as -q:v). This option enables
variable bitrate (VBR) encoding based on a fixed quality scale.
Understanding the Quality Scale Range
The -qscale:v parameter accepts integer values from
1 to 31:
- 1: Highest quality, largest file size (virtually lossless).
- 31: Lowest quality, smallest file size.
- 2 to 5: Recommended range for excellent visual quality with reasonable file sizes.
Practical Command Examples
To encode a video with high quality (using a quality scale value of 3):
ffmpeg -i input.mp4 -c:v mpeg4 -qscale:v 3 output.mp4To encode a video with a balance of decent quality and smaller file size (using a quality scale value of 6):
ffmpeg -i input.mp4 -c:v mpeg4 -qscale:v 6 output.mp4Alternative: Bitrate-Based Quality Control
If you need to target a specific file size rather than a constant
quality level, use the -b:v option to set a specific
bitrate instead of -qscale:v:
ffmpeg -i input.mp4 -c:v mpeg4 -b:v 1500k output.mp4Note: Do not use -qscale:v and -b:v at
the same time, as they conflict with each other.