Banding comes from the limited steps of 8-bit combined with encoders' tendency to spend fewer bits on flat areas. Moving to 10-bit is the most direct fix, with AQ, dither, and deband filters as supporting tools.
What banding is was covered in the Bit depth lesson. 8-bit divides each channel into only 256 steps, which isn't enough to express a gentle gradient. Here we go one step further and sort out why it stands out especially after compression, and the fixes.
Whether a filter or option exists, and its name, can vary by ffmpeg version. Check with ffmpeg -filters and ffmpeg -h filter=deband.
# 8bit
ffmpeg -ss 30 -t 10 -i input.mp4 -c:v libx265 -preset medium -crf 24 -pix_fmt yuv420p -an test_8bit.mkv
# 10bit
ffmpeg -ss 30 -t 10 -i input.mp4 -c:v libx265 -preset medium -crf 24 -pix_fmt yuv420p10le -an test_10bit.mkv# Check the filter defaults first with 'ffmpeg -h filter=deband'
ffmpeg -ss 30 -t 10 -i input.mp4 -vf "deband" -c:v libx265 -preset medium -crf 24 -pix_fmt yuv420p10le -an test_deband.mkvAll of this site's measurements are 8-bit yuv420p. There are no numbers for how much 10-bit reduces banding or how much it changes file size, and none are claimed here. Also, the default VMAF model may not catch banding as sensitively as a person, so for banding it is better to check by eye than by score. Why 10-bit encoding is practically essential for HDR is in Chapter 14.
If the source is 10-bit and you drop it to 8-bit midway and then raise it back, the banding has already been created. Check where -pix_fmt gets set in your pipeline, and if you have to go from 10-bit down to 8-bit, confirm that dither is applied at that conversion step. You can read the bit depth from the file with the video file info inspector.
A technique that varies quantization strength by the nature of each region to allocate bits. Used to give flat areas more bits, it helps reduce banding.
Filtering that detects regions where bands are visible and mixes in fine noise or smooths them to hide the bands. ffmpeg's deband and gradfun are examples.
What is the most direct response to banding in a sky gradient?
After applying a strong denoising filter, bands appeared in the sky. What is the most plausible explanation?