Configure FFmpeg Colorconstancy Minkowski and Sigma

This article provides a direct guide on how to configure the Minkowski norm and sigma parameters in the FFmpeg colorconstancy filter. You will learn the exact syntax, parameter ranges, and how adjustments to these values affect color correction and illumination estimation in your videos.

Understanding the Parameters

The colorconstancy filter in FFmpeg is used to estimate and correct the scene illumination of a video, ensuring that colors appear natural regardless of the light source. It relies on two primary configuration parameters to tune the color correction algorithm:

Syntax and Configuration

To use the colorconstancy filter, you must pass the parameters using the ffmpeg video filter (-vf) flag. The parameters can be defined using their full names or short aliases.

The basic syntax is as follows:

ffmpeg -i input.mp4 -vf "colorconstancy=minkowski=VALUE:sigma=VALUE" output.mp4

Alternatively, you can use the short aliases m and s:

ffmpeg -i input.mp4 -vf "colorconstancy=m=VALUE:s=VALUE" output.mp4

Practical Configuration Examples

Below are practical configurations depending on your processing needs:

1. Standard Grey-World (Default)

To use the default configuration (Minkowski norm of 1 and sigma of 1.0):

ffmpeg -i input.mp4 -vf "colorconstancy=minkowski=1:sigma=1.0" output.mp4

2. Max-RGB Algorithm (Brightest Pixels)

To bias the algorithm toward the brightest highlights in the frame, set the Minkowski norm to 0 and disable smoothing by setting sigma to 0:

ffmpeg -i input.mp4 -vf "colorconstancy=m=0:s=0" output.mp4

3. Noise-Resistant Grey-Edge Algorithm

For videos with significant sensor noise, increase the sigma value to smooth out noise before estimating color, and use a higher Minkowski norm (e.g., 3 or 4) to focus on major edge transitions:

ffmpeg -i input.mp4 -vf "colorconstancy=m=3:s=2.5" output.mp4