A filter chain that says scale=out_range=limited,setparams=range=tv, with -color_range tv on the output, reads like a finished job: convert a full-range H.264 file to limited range and label it that way. In this run it did neither. The source decoded as yuvj420p, and the encoded file came back as yuvj420p with color_range=pc, its pixel values not converted. One change fixed it. With format=yuv420p inserted after the scale, the next encode probed as yuv420p and tv, and its luma ran from 15 to 235. With -v error nothing was printed and the command looked complete, which worries me more than the bug itself.
The test file and how far the result goes
One Apple-silicon Mac, ffmpeg and ffprobe 9.0.2, each command run once. The input is a grey test pattern made for this test: a 1280×720 frame with a 0–255 ramp across the top and nine patches below at 0, 8, 16, 64, 128, 192, 235, 247 and 255, encoded as a 3-second H.264 clip at CRF 10 with BT.709 tags. Its pixels really use the full 0–255 range, and it is tagged full range both in the bitstream VUI and in the MP4 colr box. HEVC, 10-bit, HDR, BT.601 sources and other ffmpeg builds were not tested, so this is one data point on one build.
Getting this wrong matters because a bad range tag breaks the picture in one of two opposite directions. On this same pattern, limited-range pixels tagged as full decoded with black at 16 and white at 235, the whole picture squeezed into that band at roughly 86% of its contrast. That is the washed-out look. Full-range pixels tagged as limited went the other way: the 17 levels from 0 to 16 all decoded to 0 and the 21 levels from 235 to 255 all decoded to 255. A conversion that silently doesn't happen is one tag rewrite away from that second case.
What the two encodes actually produced
Commands and output as run, file names replaced; full.mp4 is the pattern above.
$ ffmpeg -v error -y -i full.mp4 -vf "scale=out_range=limited,setparams=range=tv" -c:v libx264 -crf 18 -color_range tv to_tv.mp4
$ ffprobe -v error -select_streams v:0 -show_entries stream=pix_fmt,color_range -of default=nw=1 to_tv.mp4
pix_fmt=yuvj420p
color_range=pc
$ ffmpeg -v error -y -i full.mp4 -vf "scale=out_range=limited,format=yuv420p,setparams=range=tv" -c:v libx264 -crf 18 -color_range tv to_tv2.mp4
$ ffprobe -v error -select_streams v:0 -show_entries stream=pix_fmt,color_range -of default=nw=1 to_tv2.mp4
pix_fmt=yuv420p
color_range=tv
$ ffmpeg -v error -i to_tv2.mp4 -vf "signalstats,metadata=print:file=-" -frames:v 1 -f null - | grep -E "YMIN|YMAX"
lavfi.signalstats.YMIN=15
lavfi.signalstats.YMAX=235
lavfi.signalstats.YMIN=15
lavfi.signalstats.YMAX=235
The first encode looks like something you could ship without a second glance. Three places ask for limited range, and the output kept the j pixel format and the pc tag anyway, with the pixels left at full range. The second encode differs by a single filter, and that was enough for yuv420p, tv and luma between 15 and 235. The doubled YMIN and YMAX lines are how the metadata filter prints one frame. The 15 sits one code value under nominal black, and this run didn't look into where that value comes from. One more limit: -show_streams reads the container-level tag here, and a frame-level read of the bitstream tag wasn't part of this pair.
Why I think the j format wins
This section is inference, not something this run tested. The yuvj* formats are ffmpeg's older way of saying "full range" through the pixel format name itself. My guess is that with no explicit format in the chain, negotiation kept yuvj420p from decoder to encoder. If the scaler is asked to output a format that still means full range, out_range=limited either has nothing to act on or gets overridden. On the encoder side, the range flag would then follow the j format rather than setparams or -color_range. Forcing format=yuv420p removes that meaning from the pixel format, so the scaler has to produce real limited-range values and the tags can follow what setparams says. I haven't read the scale filter or the libx264 wrapper source to see which step does the overriding. I haven't checked whether other ffmpeg releases do the same, so another build could behave differently.
A probe after every range conversion
What I'd add to a transcode step is a check on the file that comes out, not a review of the flags that went in. Read pix_fmt and color_range with ffprobe, then run signalstats on one frame. For a limited-range target, the pix_fmt should not carry a j, the range should read tv, and YMIN and YMAX should land near 16 and 235 rather than 0 and 255.
The same probe works where there is no command line to inspect. For one-off compression in the browser I use ImgIng https://imging.ai/ , whose product notes dated 2026-09-15 mention a fix for full-range videos having their brightness range narrowed. When the same full-range pattern went through its "visually near-lossless" setting in desktop Chromium, the output came back as limited range tagged tv, decoding to 0 and 255 for H.265 and 2 and 254 for H.264. So it converts rather than keeping full range, and it labels the result correctly; how it does that inside is not something I can see from outside. On a 3-second still pattern the compressed file got bigger, so the tool didn't adopt it automatically and the candidate was saved by hand. Read that as a check on the tags, not on picture quality.
Top comments (0)