How to Clamp Video Levels Using FFmpeg Limiter
Clamping video levels to broadcast-safe ranges is essential for
preventing signal clipping, color distortion, and rejection by broadcast
distribution platforms. In 8-bit digital video, standard broadcast legal
range (Rec. 709 / "narrow" range) restricts luminance (Y) to values
between 16 and 235 and chrominance (U/V) to values between 16 and 240.
This guide explains how to use FFmpeg's built-in limiter
video filter to enforce these exact thresholds cleanly and
efficiently.
The Basic Command
To clamp video levels to 16–235 for luma and 16–240 for chroma, use
the limiter filter within the -vf (video
filter) flag:
ffmpeg -i input.mp4 -vf "limiter=min0=16:max0=235:min1=16:max1=240:min2=16:max2=240" -c:v libx264 -crf 18 -c:a copy output.mp4How the Parameters Work
The limiter filter allows you to set the lower and upper
bounds for each plane of video data independently:
min0andmax0: Define the minimum and maximum boundaries for plane 0, which corresponds to the luminance channel (\(Y\)). Settingmin0=16andmax0=235clamps the black point to 16 and peak white to 235.min1andmax1: Define the boundaries for plane 1, representing the first chroma difference channel (\(U\) or \(Cb\)). Settingmin1=16andmax1=240cuts off out-of-gamut chroma values.min2andmax2: Define the boundaries for plane 2, representing the second chroma difference channel (\(V\) or \(Cr\)). Settingmin2=16andmax2=240limits chroma excursions identically to plane 1.
Values outside these defined intervals are not scaled; they are hard-clipped to the boundary thresholds.
Shorthand Syntax
FFmpeg accepts positional arguments for the limiter
filter. The following command is functionally identical to the explicit
parameter version:
ffmpeg -i input.mp4 -vf "limiter=16:235:16:240:16:240" -c:v libx264 -crf 18 -c:a copy output.mp4The arguments correspond in order to min0,
max0, min1, max1,
min2, and max2.
Preserving Metadata Flags
When clamping pixel data to standard TV levels, it is best practice
to ensure the output container's metadata explicitly reflects the
limited range. You can add the -color_range tv option to
instruct players and decoders to interpret the signal as limited
range:
ffmpeg -i input.mp4 -vf "limiter=16:235:16:240:16:240" -color_range tv -c:v libx264 -crf 18 -c:a copy output.mp4