今日已更新 351 条资讯 | 累计 41571 条内容
关于我们

Build a repeatable banding test with FFmpeg (and find the ladder rung that breaks first)

Mason K 2026年09月10日 14:55 2 次阅读 来源:Dev.to

TL;DR Banding arguments go in circles because everyone tests on different footage. We are going to generate a synthetic gradient, encode it four ways (naive 8-bit, 8-bit debanded, 10-bit filter graph with explicit dither, and 10-bit AV1), and build a small harness so you can run it on your own ladder. Everything runs locally with FFmpeg, no assets to download. Written against FFmpeg 7.x/8.x . Check yours with ffmpeg -version . 1. Generate a worst-case clip 🎨 Real footage has sensor noise, and that noise dithers away banding by accident. To see the problem clearly you want a clip with none: # 10 seconds of a slow horizontal gradient, 1080p, no noise ffmpeg -f lavfi -i "gradients=s=1920x1080:c0=0x101020:c1=0x404860: \ type=linear:nb_colors=2:speed=0.01:d=10" \ -pix_fmt yuv420p10le -c :v ffv1 \ master.mkv # what you should see Output #0, matroska, to 'master.mkv': Stream #0:0: Video: ffv1, yuv420p10le, 1920x1080, 25 fps We keep the master lossless and 10-bit so every later step is the only lossy thing happening. Dark blues are deliberate: banding is worst in the low end, which is also where nobody looks. 💡 Tip: keep a second master made from real footage (a sunset, a studio backdrop, a fade to black). The synthetic clip finds the problem; real footage tells you whether the fix survives contact with grain. 2. Encode it four ways 🛠️ A. The naive 8-bit encode ffmpeg -i master.mkv \ -vf "format=yuv420p" \ -c :v libx264 -profile :v high -preset medium -crf 23 \ -pix_fmt yuv420p out_a_naive.mp4 This is what most ladders do. It is the baseline. B. Debanding in an 8-bit graph ffmpeg -i master.mkv \ -vf "format=yuv420p,gradfun=strength=1.2:radius=16" \ -c :v libx264 -profile :v high -preset medium -crf 23 \ -pix_fmt yuv420p out_b_gradfun8.mp4 gradfun fits the gradient that should be in the flat region and dithers it back in. strength is both the maximum change per pixel and the flat-region detection threshold (range 0.51 to 64 , default 1.2 ). radius is the neighbourhood used f

本文内容来源于互联网,版权归原作者所有
查看原文