Ch. 19 · Diagnosing Video Quality Problems

한국어日本語
7 min

Ringing and Mosquito Noise: Ripples Around Edges

Ripples left around sharp edges are ringing, and when they shimmer from frame to frame around moving objects, they look like mosquito noise. The causes are quantization of high frequencies and excessive sharpening or resizing.

Transform coding splits video into frequency components and treats the high frequencies more coarsely first (Transform lesson). Edges where values change abruptly, like text and lines, carry a lot of high-frequency content, so when quantization shaves it off, oscillation is left around the edge. This is ringing. Halos or ripples appear next to the edge.

Ringing and mosquito noise share the same root

  • Ringing is the ripple left around an edge within a single frame. It stands out in content with many artificial edges, such as text, lines, and screen recordings (the same phenomenon you get when saving a text screenshot as JPEG, Chapter 4).
  • Mosquito noise is those ripples appearing differently each frame around the outlines of moving objects, so they shimmer. The name comes from the look of mosquitoes flying around the outline. In a single frame it resembles ringing; the difference is that when you watch consecutive frames, it changes over time.

The cause isn't only the encode

CauseHow the ringing arisesHow to tell
High-frequency quantization in the encoderThe edge's high-frequency components get shaved and oscillation is leftNot in the source frame, only in the output
Excessive sharpening on the input sideA sharpening filter creates halos at edges. Once those halos are encoded, they stand out even moreApply only the pre-encode filters and save: you already see it
Choice of resize filterSharp resize filters such as lanczos are known to cause overshoot around edges (scale lesson)It is visible in the intermediate result with only scale applied
Already in the sourceTraces of earlier compression or upscalingConfirmed in the source frame

So when you see ringing, it's best to check the pipeline's intermediate results before blaming the encoder. If the same pattern shows up in a file saved near-losslessly with only the filters applied, changing encoder settings won't help.

Save only the filter stage separately to find the source of ringing (using lossless FFV1)
# Apply only the filters that run before encoding and save losslessly -> if it is already visible in this file, the filters are the cause
ffmpeg -ss 30 -t 5 -i input.mp4 -vf "scale=1280:720:flags=lanczos,unsharp" -c:v ffv1 -an stage_filters.mkv

Fixes

  • Reduce quantization. Raising the bitrate or lowering CRF keeps more of the high-frequency content around edges. In this site's numbers, even the same CRF gave different results per video (crf-by-content), so how far to lower it has to be checked for each video.
  • Weaken or drop the sharpening. Adding halos where the encoder is going to spend bits anyway is a net loss.
  • Try changing the resize filter. Switching to a filter with less overshoot (for example, bicubic) may reduce it. The difference between filters varies by video, so check by eye.
  • Use a codec with in-loop filters. Filters such as SAO in HEVC and CDEF in AV1 are designed to reduce ringing (In-loop filter lesson). However, this site has not measured ringing levels by codec.
  • Treat text and screen recordings separately. They are mostly sharp edges, so the combination of 4:2:0 and a high CRF is especially annoying. For this kind of content, lowering CRF is the most direct fix.
Denoising can reduce ringing, or make it worse

The filters from the denoising lesson save bits by erasing noise, but they can blur edges or, at strong settings, wipe out texture and create other problems. When you use one against ringing, start weak and check the result by eye.

RingingRinging

Ripples or halos around sharp edges. They come from quantization of high-frequency components or from excessive sharpening or resizing.

Mosquito noiseMosquito noise

Distortion where ringing around the outlines of moving objects differs from frame to frame and shimmers.

OvershootOvershoot

When a filter pushes values next to an edge outside their original range, creating a halo. It is most likely with sharp filters.

Check yourself

'There are ripples around the text, and the same ripples show up in a file where I applied only the filters before encoding and saved it losslessly.' Where is the cause most likely to be?

Check yourself

Which describes the difference between ringing and mosquito noise?