DEV Community

Peiguan
Peiguan

Posted on

Why Does My Tiny Desk AI Clip Look Washed Out in Premiere or CapCut? Limited vs Full TV Range With ffmpeg (Tested)

I dropped a vertical desk clip on a timeline and the blacks looked gray. A friend imported the same kind of file into CapCut and got the opposite: a contrasty, slightly crushed picture. Both of those looks are what you get when a "limited" TV-range file (luma coded 16–235) and a "full" PC-range file (luma coded 0–255) are interpreted as each other. The file can be honest and the editor can still be wrong, or the flag on the file can be lying. The histogram is the thing that does not care about the flag.

Tiny Desk Outstanding delivers a short vertical clip with the original soundtrack. This is not about the joke or the price. It is about what happens after you import the MP4. I built four synthetic 2-second luma-ramp clips, then I ran the same checker on the eight public homepage samples (re-downloaded 17 November 2026, SHA-256 verified). Scripts and numbers are below.

Limited vs full, in one paragraph

In 8-bit video, legal TV range (also called limited, or color_range=tv) puts black at Y=16 and white at Y=235. Full range (color_range=pc) puts black at 0 and white at 255. If a limited file is shown as full, Y=16 becomes a dark gray (16/255 ≈ 6.27%) and Y=235 becomes a dull white (235/255 ≈ 92.16%). That is the washed-out look. If a full-range file is shown as limited, 0 is treated as "below black" and 255 as "above white," so the midtones stretch and the extremes crush or clip. That is the overly contrasty look.

Premiere, DaVinci, and CapCut all have some version of "Interpret as" or an automatic range guess. The guess is only as good as the flag on the file, and I will show a file whose flag is deliberately wrong.

Do not histogram the converted gray plane

The first version of my checker decoded to pix_fmt=gray. On a limited-range source, that conversion expanded 16–235 to 0–255, and every honest limited ramp looked like a full-range file. The useful measurement is the coded Y plane, with no TV↔PC conversion. The script below reads raw yuv420p and histograms only the Y bytes.

The scripts

A 720×1280, 30 fps, 2-second ramp with a legal-black / mid / legal-white patch along the top. Two honest encodes, then two "mislabeled" copies that keep the same pixels and only flip the H.264 video_full_range_flag. Re-encoding with -color_range is the wrong way to make a mislabeled file: ffmpeg will convert the pixels to match the flag. A bitstream filter does not.

#!/usr/bin/env python3
"""Build short synthetic luma-ramp clips in limited (TV) and full (PC) range.

Clips are 720x1280, 30 fps, 2 seconds, labeled synthetic. Each frame is a
horizontal luma ramp plus a mid-gray patch and a legal-black / legal-white
patch so a histogram has a known shape.
"""
import os, subprocess, sys, tempfile
import numpy as np

OUT = os.path.dirname(os.path.abspath(__file__))
W, H, FPS, N = 720, 1280, 30, 60  # 2.000 s


def ramp_frame(limited):
    # Horizontal ramp: left=black, right=white.
    x = np.linspace(0, 1, W, dtype=np.float64)
    if limited:
        y = np.clip(np.round(16 + 219 * x), 16, 235).astype(np.uint8)
        black, mid, white = 16, 125, 235  # mid ≈ (16+235)/2
    else:
        y = np.clip(np.round(255 * x), 0, 255).astype(np.uint8)
        black, mid, white = 0, 128, 255
    frame = np.repeat(y[None, :], H, axis=0)
    # 80x80 patches along the top: legal black, mid gray, legal white.
    frame[40:120, 40:120] = black
    frame[40:120, 300:380] = mid
    frame[40:120, 580:660] = white
    return frame


def write_yuv(path, frames):
    # yuv420p: Y full, U/V mid (128) subsampled.
    uv = np.full((H // 2, W // 2), 128, dtype=np.uint8)
    with open(path, "wb") as f:
        for y in frames:
            f.write(y.tobytes())
            f.write(uv.tobytes())
            f.write(uv.tobytes())


def encode(yuv, out, color_range):
    # color_range: "tv" (limited) or "pc" (full)
    cmd = [
        "ffmpeg", "-y", "-hide_banner", "-loglevel", "error",
        "-f", "rawvideo", "-pix_fmt", "yuv420p", "-s", f"{W}x{H}",
        "-r", str(FPS), "-i", yuv,
        "-c:v", "libx264", "-preset", "medium", "-crf", "14",
        "-pix_fmt", "yuv420p", "-color_range", color_range,
        "-colorspace", "bt709", "-color_primaries", "bt709", "-color_trc", "bt709",
        "-movflags", "+faststart", out,
    ]
    subprocess.check_call(cmd)


def main():
    os.makedirs(OUT, exist_ok=True)
    limited = [ramp_frame(True) for _ in range(N)]
    full = [ramp_frame(False) for _ in range(N)]
    with tempfile.TemporaryDirectory() as td:
        write_yuv(f"{td}/lim.yuv", limited)
        write_yuv(f"{td}/full.yuv", full)
        # Honest tags: content matches the flag.
        encode(f"{td}/lim.yuv", f"{OUT}/limited_ramp.mp4", "tv")
        encode(f"{td}/full.yuv", f"{OUT}/full_ramp.mp4", "pc")
    # Mislabeled: same coded pixels, opposite range flag. Re-encoding
    # with -color_range would convert the pixels; a bitstream filter
    # only flips the flag, which is the "Interpret as" mistake.
    def flag_only(src, dst, full_range):
        subprocess.check_call([
            "ffmpeg", "-y", "-hide_banner", "-loglevel", "error",
            "-i", src, "-c", "copy",
            "-bsf:v", f"h264_metadata=video_full_range_flag={1 if full_range else 0}",
            dst,
        ])
    flag_only(f"{OUT}/limited_ramp.mp4", f"{OUT}/limited_tagged_pc.mp4", True)
    flag_only(f"{OUT}/full_ramp.mp4", f"{OUT}/full_tagged_tv.mp4", False)
    print("wrote", "limited_ramp.mp4", "full_ramp.mp4",
          "limited_tagged_pc.mp4", "full_tagged_tv.mp4")
    return 0


if __name__ == "__main__":
    sys.exit(main())
Enter fullscreen mode Exit fullscreen mode
#!/usr/bin/env python3
"""Measure luma range (limited TV 16-235 vs full PC 0-255) with a histogram.

Reads the Y plane as 8-bit gray, builds a 256-bin histogram, and compares
that to the file's color_range tag. Also reports how a mid-gray patch
would display if the other range is assumed.

Usage:
  python3 range_check.py clip.mp4 [clip2.mp4 ...]
"""
import json, os, subprocess, sys
import numpy as np

def ffprobe(path):
    raw = subprocess.check_output([
        "ffprobe", "-v", "error", "-print_format", "json",
        "-show_format", "-show_streams", "-show_entries",
        "stream_tags:format_tags", path,
    ])
    return json.loads(raw)


def luma_hist(path):
    info = ffprobe(path)
    vs = [s for s in info.get("streams") or [] if s.get("codec_type") == "video"]
    if not vs:
        raise SystemExit(f"no video stream: {path}")
    v = vs[0]
    w, h = int(v["width"]), int(v["height"])
    # Decode the coded Y plane with no TV<->PC conversion.
    # (pix_fmt=gray would expand limited 16-235 to 0-255 and lie.)
    # yuv420p / yuvj420p have the same layout: Y (w*h) then U,V (w*h/4 each).
    proc = subprocess.Popen([
        "ffmpeg", "-hide_banner", "-loglevel", "error",
        "-i", path, "-an", "-f", "rawvideo", "-pix_fmt", "yuv420p", "pipe:1",
    ], stdout=subprocess.PIPE)
    hist = np.zeros(256, dtype=np.int64)
    n_frames = 0
    y_bytes = w * h
    frame_bytes = y_bytes * 3 // 2
    while True:
        buf = proc.stdout.read(frame_bytes)
        if not buf:
            break
        if len(buf) < frame_bytes:
            break
        y = np.frombuffer(buf[:y_bytes], dtype=np.uint8)
        hist += np.bincount(y, minlength=256)
        n_frames += 1
    proc.stdout.close()
    rc = proc.wait()
    if rc != 0:
        raise SystemExit(f"ffmpeg decode failed ({rc}): {path}")
    total = int(hist.sum())
    if total == 0 or n_frames == 0:
        raise SystemExit(f"no luma samples: {path}")
    cdf = np.cumsum(hist)
    def pctile(p):
        # p in 0..100
        thresh = (p / 100.0) * total
        return int(np.searchsorted(cdf, thresh, side="left"))
    below = int(hist[:16].sum())
    legal = int(hist[16:236].sum())
    above = int(hist[236:].sum())
    # How a legal-black / legal-white / mid pixel would display under
    # the opposite interpretation, as a 0..1 display value.
    # Limited->display: (Y-16)/219 ; Full->display: Y/255.
    def display(y, assume):
        if assume == "tv":
            return float(np.clip((y - 16) / 219.0, 0, 1))
        return float(np.clip(y / 255.0, 0, 1))

    # Typical legal black/white in each coding.
    washed = {  # limited pixels displayed as full (looks gray / washed)
        "black16_as_pc": round(display(16, "pc"), 4),
        "white235_as_pc": round(display(235, "pc"), 4),
        "mid125_as_pc": round(display(125, "pc"), 4),
    }
    contrasty = {  # full pixels displayed as limited (crushed / clipped)
        "black0_as_tv": round(display(0, "tv"), 4),
        "white255_as_tv": round(display(255, "tv"), 4),
        "mid128_as_tv": round(display(128, "tv"), 4),
    }
    tag = (v.get("color_range") or v.get("tags", {}).get("color_range") or "")
    # ffprobe may put color_range on the stream object directly.
    color_range = v.get("color_range") or tag or "unspecified"
    # Heuristic: more than 0.5% of samples outside 16-235 => looks full.
    pct_outside = 100.0 * (below + above) / total
    if pct_outside < 0.05 and hist[0] == 0 and hist[255] == 0:
        look = "limited"
    elif below + above == 0:
        look = "limited"
    elif pct_outside >= 0.5:
        look = "full_or_super"
    else:
        look = "mostly_limited_with_excursions"
    return {
        "file": os.path.basename(path),
        "width": w, "height": h,
        "pix_fmt": v.get("pix_fmt"),
        "color_range_tag": color_range,
        "color_space": v.get("color_space") or "unspecified",
        "color_primaries": v.get("color_primaries") or "unspecified",
        "color_trc": v.get("color_trc") or "unspecified",
        "frames": n_frames,
        "y_min": int(np.min(np.flatnonzero(hist))) if total else None,
        "y_max": int(np.max(np.flatnonzero(hist))) if total else None,
        "y_p01": pctile(1), "y_p50": pctile(50), "y_p99": pctile(99),
        "pct_below_16": round(100.0 * below / total, 4),
        "pct_16_235": round(100.0 * legal / total, 4),
        "pct_above_235": round(100.0 * above / total, 4),
        "histogram_looks_like": look,
        "washed_if_limited_shown_as_full": washed,
        "contrasty_if_full_shown_as_limited": contrasty,
    }


def main(argv):
    if len(argv) < 2:
        print("usage: range_check.py clip.mp4 [...]", file=sys.stderr)
        return 2
    rows = []
    for p in argv[1:]:
        row = luma_hist(p)
        rows.append(row)
        print(f"{row['file']}: tag={row['color_range_tag']} "
              f"Y={row['y_min']}..{row['y_max']} "
              f"p01={row['y_p01']} p99={row['y_p99']} "
              f"below16={row['pct_below_16']}% "
              f"legal={row['pct_16_235']}% "
              f"above235={row['pct_above_235']}% "
              f"looks={row['histogram_looks_like']}")
    print(json.dumps(rows, indent=2))
    return 0


if __name__ == "__main__":
    sys.exit(main(sys.argv))
Enter fullscreen mode Exit fullscreen mode

I ran them on this box (ffmpeg 7.1.5, Python 3, numpy) on 17 November 2026. Every command below exited 0.

Synthetic results

limited_ramp.mp4:      tag=tv  Y=16..235  p01=16  p99=233  below16=0.0%     legal=100.0%    above235=0.0%     looks=limited
full_ramp.mp4:         tag=pc  Y=0..255   p01=0   p99=255  below16=11.9792% legal=73.3941%  above235=14.6267% looks=full_or_super
limited_tagged_pc.mp4: tag=pc  Y=16..235  p01=16  p99=233  below16=0.0%     legal=100.0%    above235=0.0%     looks=limited
full_tagged_tv.mp4:    tag=tv  Y=0..255   p01=0   p99=255  below16=11.9792% legal=73.3941%  above235=14.6267% looks=full_or_super
Enter fullscreen mode Exit fullscreen mode

The first two files are consistent: the tag matches the histogram. The third file is the washed-out trap. The pixels are still 16–235 (100% legal), but the flag says full range. An editor that trusts the flag will display legal black as 6.27% gray and legal white as 92.16%. The fourth file is the contrasty trap: the pixels still go 0–255, but the flag says TV, so an editor that expands 16–235 will crush the real blacks and clip the real whites.

If your clip looks wrong and the histogram says 16–235, set the clip to limited / legal / video range, not full / JPEG / RGB 0–255. If the histogram really does go to 0 and 255 with a few percent of the samples outside 16–235, the file is full-range (or has super-blacks / super-whites), and forcing limited will make it harsher.

The eight public samples

These are the homepage samples, not paid customer renders. I measured every decoded frame's coded Y plane.

File (sha256 prefix) Homepage claim Tag Y min..max % below 16 % 16–235 % above 235 Looks like
db09b1c54359b093 15-second scene reference unspecified 2..253 0.0044 99.9951 0.0005 limited
db033545db008394 "10-second" gallery cut tv 0..255 0.1190 99.8639 0.0172 mostly limited, with excursions
f7ff526861130818 "Longer cut" tv 0..255 0.1225 99.8625 0.0150 mostly limited, with excursions
875d2458181e3467 "Four-second" close-up unspecified 0..255 0.0643 99.8350 0.1007 mostly limited, with excursions
0299078c3f432f8b gallery, no duration in title tv 0..252 0.0467 99.9518 0.0015 mostly limited, with excursions
632c0129d45a4c0a cats at the desk tv 0..255 0.0286 99.9703 0.0011 mostly limited, with excursions
947f5eb2a447eb6c gallery, no duration in title tv 0..255 0.0428 99.9545 0.0026 mostly limited, with excursions
8256cd873b7ea128 gallery, no duration in title unspecified 5..247 1.5376 98.4609 0.0015 full_or_super

The official reference (db09, 720×1280, also the Just Me / Back Row / Whole Band preview file) is the cleanest limited-looking picture of the eight: 99.9951% of samples sit in 16–235, and the color_range tag is unspecified. If an NLE defaults "unspecified" to full range, this is the file that will look washed out even though the histogram says limited.

Most of the other gallery cuts are tagged tv and still have a fraction of a percent of samples below 16 or above 235. I would still treat them as limited and not panic about a few extreme pixels. The outlier is 8256…, a 480×854 file with an unspecified tag and 1.54% of samples below 16. That is the one I would actually inspect before picking an Interpret-as mode.

What I would do in the editor

  1. Run range_check.py on the download, not on a frame you already exported from the NLE.
  2. If it looks limited (the legal bin is ~100%, or p01 sits near 16 and p99 near 235), interpret as limited / legal / Rec. 709 video. That is the typical broadcast MP4.
  3. If it looks full, interpret as full / 0–255. Forcing TV range on that file is how you get the contrasty import.
  4. Do not "fix" it by slapping a contrast LUT on top until you have checked the range. You would be grading the mistake.

The studio's public pages do not mention color range, and I will not pretend they do. A single video, before tax, is $9.98 at 480p, $12.98 at 720p, $24.98 at 1080p, or $39.98 at 4K, the same for every scene, as listed on pricing on 17 November 2026 (tables recorded 12 November). There is no free preview. If the imported clip looks wrong, check the histogram before you blame the generator or the grade.

Top comments (0)