What is the ffmpeg -subcmp parameter

This article explains the function of the -subcmp parameter in FFmpeg, detailing how it controls sub-pixel motion estimation comparison during video encoding. You will learn what this parameter does, how it impacts video quality and encoding speed, and the common values you can use in your command-line workflows.

The -subcmp parameter in FFmpeg stands for sub-pixel comparison. It is an encoding option used to set the comparison function (or decision metric) for sub-pixel motion estimation during video compression.

How Motion Estimation Works

Video encoders compress video by looking for movement between frames, a process called motion estimation. Instead of saving every pixel of every frame, the encoder identifies blocks of pixels that have shifted from one frame to the next. To achieve higher precision, modern encoders perform this search at the sub-pixel level (such as half-pixel or quarter-pixel accuracy) by interpolating the space between pixels.

The Role of -subcmp

The -subcmp parameter determines the mathematical algorithm the encoder uses to compare these sub-pixel blocks and decide which match is the most accurate. Choosing a more precise comparison algorithm results in better compression and higher video quality, but it requires more CPU processing power.

Common Values and Metrics

You can assign different comparison functions to -subcmp. The most common options include:

Practical Usage

To use the -subcmp parameter in an FFmpeg command, you append it to your encoder settings. For example, to set the sub-pixel comparison to use the Hadamard transform (satd) with an MPEG-4 encoder, you would use the following syntax:

ffmpeg -i input.mp4 -c:v mpeg4 -subcmp satd output.mp4

Adjusting this parameter allows you to fine-tune the balance between encoding speed and the final output’s visual quality based on your hardware capabilities and project requirements.