Ch. 19 · Diagnosing Video Quality Problems

한국어日本語
8 min

Banding: When Stripes Appear in the Sky

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.

There are two layers of cause

  • Representation limit (8-bit). When the difference between two adjacent brightness steps starts to be visible, it is perceived as a band. Differences between steps are known to be easier to see in dark areas.
  • Compression smears flat areas even more. Areas with little change, like the sky, have small residuals, so when quantization is coarse, that small variation is thrown away entirely as zero. Steps that were hidden by noise in the source can show up after compression.
  • Preprocessing removes noise that was helping. Denoising filters (Chapter 17) erase fine noise in the source to save size, but if that noise was masking the banding, the bands can show up.
  • Playback-side conversion. On a path where a 10-bit file is output as 8-bit, steps can be lost at the display stage. You need to tell whether the file or the playback path is the problem.

Fixes

KnobPrincipleCost and limits
Encode in 10-bitMore representation steps let gentle changes be expressed more smoothly. Chapter 1 explained that it also helps compression efficiencyHardware decoder compatibility may narrow. Whether moving up from an 8-bit source helps depends on the video
Adjust AQ (adaptive quantization)Adjusts quantization to allocate more bits to flat areas. aq-mode and aq-strength in x264 and x265 are known to do thisBits for other areas may shrink. Check each mode's behavior in the encoder docs
Lower CRFKeeps even the small residuals in flat areasBanding sometimes remains even after lowering CRF quite a bit. Only the file size may grow
Dither / deband filtersMixes in fine noise to scatter the band edges. ffmpeg has deband and gradfun filtersNoise is the enemy of compression, so it costs bits (Chapter 1). Start weak
Film grain synthesis (AV1)Instead of encoding the grain, synthesize it at playback to cut the cost (Chapter 7)Only available in AV1, and support depends on the encoder and player

Whether a filter or option exists, and its name, can vary by ffmpeg version. Check with ffmpeg -filters and ffmpeg -h filter=deband.

Try encoding in 10-bit (compare size and banding against 8-bit on the same segment)
# 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
Deband lightly before encoding (the values are only a starting point)
# 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.mkv
This site measured only 8-bit

All 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.

In practice: stop it at the 8-bit conversion step

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.

AQAdaptive quantization

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.

DebandingDebanding

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.

Check yourself

What is the most direct response to banding in a sky gradient?

Check yourself

After applying a strong denoising filter, bands appeared in the sky. What is the most plausible explanation?