Advertisement

Technical Deep Dives10 min read

Why Red Text and Fine Edges Fall Apart in Video

Video keeps brightness at full resolution and discards three quarters of the colour samples. That is why saturated text smears, thin coloured lines dissolve, and a cutout edge picks up a halo the still image never had. No quality setting undoes it.

By · Part of the Image processing and on-device AI topic cluster

Put a line of red text on a slide, export it as a PNG, and it is crisp. Put the same line of red text on a video, export it, and the edges have gone soft and slightly muddy. Nothing you do to the quality setting quite fixes it.

The same effect shows up in other places once you know what it looks like. A screen recording where syntax-highlighted code is legible in white and slightly smeared in orange. A cutout composited over a new background where the outline picks up a faint colour halo that was not there in the still. A thin blue graph line that survives at 1080p and dissolves at 720p while the black lines beside it are fine.

They are all one mechanism, and it is not a bug in anything. It is a deliberate design decision baked into every video format you are likely to use.

Video does not store colour at full resolution

An image format like PNG stores three colour values for every single pixel. Video, almost universally, does not.

Video encoders first separate brightness from colour. One channel, the luma channel, carries how light each pixel is. Two more channels carry the colour information. Then they do something that would be unthinkable in a still image format: they throw away three quarters of the colour samples.

In the arrangement called 4:2:0, the luma channel keeps one value per pixel, and the two colour channels are stored at half resolution horizontally and half vertically. A two-by-two block of four pixels has four separate brightness values and a single shared colour. Whatever colour differences existed inside that block are averaged into one.

This is not an obscure high-compression mode. H.264 inside an MP4 and VP9 inside a WebM, which are the delivery formats these tools produce, are used in this form the way essentially all consumer video is. Your phone records this way. Every streaming platform delivers this way. The video you are comparing against looks fine because it is also 4:2:0.

Why it is not as terrible as it sounds

Human vision is much better at resolving fine differences in brightness than fine differences in colour. That is a genuine property of the eye, not an engineering excuse, and it is why this trick has survived since analogue colour television.

For ordinary footage of people and places, it is close to invisible. Faces, landscapes, and rooms are full of brightness detail and relatively smooth in colour, which is exactly the case the format was designed around. Discarding three quarters of the colour samples saves an enormous amount of data and costs you almost nothing you can see.

Where it becomes visible

It breaks down on content where the detail is carried by colour rather than brightness. Three cases account for nearly everything:

Saturated coloured text, especially red. Red against a dark background is a large colour difference and a relatively small brightness difference. Subsample the colour and the edge of every letter is now shared with its neighbours. The letters look soft, and at small sizes the strokes bleed into each other.

Thin lines and fine graphics. A one-pixel coloured line occupies half of one colour sample. It is averaged with whatever is beside it before the encoder even starts compressing. Charts, diagrams, and user interface screenshots suffer here in a way that photographs do not.

Edges between two strongly different colours. This is the one that catches people compositing. A cutout placed over a new background creates exactly such an edge, and the shared colour samples straddling it produce a thin band that belongs to neither side. It reads as a halo, and unlike the colour contamination that comes from a bad mask, this one is created at encode time and was genuinely not in your source.

Turning the quality up does not fix it

This is the part worth knowing, because it is where people waste their afternoon.

Raising the quality setting on a compressor reduces compression artefacts: blocking, ringing, mosquito noise around edges. Those are real and they are worth fixing. But chroma subsampling is not a compression artefact. It happens before the compression decisions, as part of how the picture is represented, and no bitrate makes the discarded colour samples come back.

You can confirm this on your own footage in a couple of minutes. Encode the same clip at a high quality setting and a low one and look at the red text in both. The low-quality version has extra problems around it. The softness is in both.

What actually works

Since the format will not change, the design has to.

Put contrast in brightness, not only in colour. Text that is much lighter or much darker than its background survives, because the brightness channel is at full resolution. Text that differs from its background mainly in hue does not. White text over a dark backdrop is the most robust combination there is, which is not a coincidence and is why almost every burned-in caption you have ever seen is white.

Give coloured text an outline or a shadow. A dark outline around light text is a brightness edge, and a brightness edge is stored at full resolution. It does more for legibility than any amount of encoder tuning.

Make it bigger and heavier than feels necessary. A stroke that spans several pixels survives colour averaging; a hairline does not. If text has to be red, it has to be chunky.

Do not scale down and hope. Resizing a video resamples an already subsampled picture. Whatever colour detail was marginal at the source resolution is gone at half of it. If a graphic needs to be legible at 720p, check it at 720p rather than assuming the 1080p version tells you.

Check the destination, not the editor. The preview inside an editor may be working from a much less compressed representation than the file you export. The only honest test is to export and watch the export.

For cutouts specifically

If you are compositing a transparent subject over a new background in video, two things help.

Choose a replacement background whose brightness is not wildly different from the subject's edge. A subject with dark hair over a bright white background creates the largest possible edge for the encoder to make a mess of. The same subject over a mid-grey does not.

And judge the result on the exported file rather than on the timeline. A halo that is absent in the editor and present in the export is this effect, and it tells you the mask is fine and the encode is what needs adjusting.

The one-line version

Video stores brightness at full resolution and colour at a quarter of it. Anything whose detail lives in colour rather than brightness gets averaged away, no quality setting will bring it back, and the fix is to design so that the important edges are brightness edges.

Applies to NSS Background Remover v2.5.0, the release that was current when this article was published.

Was this article helpful?

Your answer is saved in this browser only. This control makes no network request and does not send the answer to an NSS feedback endpoint.

Found this useful?