How to Force FFmpeg Input to Full Color Range

When processing video files, FFmpeg sometimes incorrectly detects the color range of the input, leading to washed-out colors or clipped blacks and whites. This article provides a quick guide on how to explicitly force FFmpeg to interpret your input video as full color range (PC range, 0-255) rather than limited range (TV range, 16-235) using specific command-line arguments and video filters.

Method 1: Using the -color_range Input Option

The most direct way to force the input color range is to use the -color_range option. This option must be placed before the input file (-i) in your command line so that it applies to the demuxer/decoder.

ffmpeg -color_range pc -i input.mp4 -c:v libx264 -pix_fmt yuv420p output.mp4

In this command: * -color_range pc (or 2) forces the decoder to interpret the input stream as full range (0-255). * -pix_fmt yuv420p ensures the output is written in a widely compatible format, while preserving the color conversion.

Method 2: Using the setparams Video Filter

If the decoder ignores the input flag, or if you want to flag the color range programmatically during the filtering stage without scaling the video, you can use the setparams filter.

ffmpeg -i input.mp4 -vf setparams=range=full -c:v libx264 output.mp4

The setparams=range=full filter forces FFmpeg to treat the video frames as full range during processing and tags the output metadata accordingly.

Method 3: Using the scale Filter for Range Conversion

If you need to convert or ensure that the pixel values themselves are correctly scaled and interpreted, use the scale software filter. This is highly effective when converting from an incorrectly flagged input to a specific output range.

ffmpeg -i input.mp4 -vf scale=in_range=full:out_range=full -c:v libx264 output.mp4

Verifying the Output Color Range

To verify if your output video has been correctly tagged as full range, you can run ffprobe on the generated file:

ffprobe -v error -show_entries stream=color_range -of default=noprint_wrappers=1 input.mp4

If successful, the console output should display color_range=pc.