encoding-guide

Artifact Reduction

Artifact reduction is a vital process for improving the quality of video sources, particularly those that have been heavily compressed or poorly encoded. Artifacts manifest as visual distortions and can significantly detract from the viewing experience. This guide explores the most common artifacts in depth, including practical solutions tailored to address them.


Understanding Common Artifacts

1. Blocking

2. Banding

3. Ringing

4. Mosquito Noise

5. Debris


Reducing Specific Artifacts

1. Blocking

Blocking is common in heavily compressed content and can be particularly challenging to address.

Basic Deblocking

Advanced Deblocking

Multi-Pass Deblocking


2. Banding

Banding occurs in gradients and smooth transitions. It’s especially noticeable in skies, shadows, and HDR content.

Debanding with f3kdb

Gradient Masking

HDR-Specific Banding


3. Ringing

Ringing can be subtle but becomes highly distracting when sharpening filters are over-applied.

Basic Deringing

Edge-Aware Filtering


4. Mosquito Noise

Mosquito noise clusters around edges and often requires a combination of temporal and spatial filtering.

Targeted Mosquito Noise Reduction

Temporal-Specific Noise Reduction


5. General Artifacts

For sources with a mix of artifacts, use versatile tools like SMDegrain:

Multi-Artifact Reduction

Pre-Processing for General Artifacts


Example Comprehensive Workflow

Here’s a full script addressing multiple artifacts:

import vapoursynth as vs
core = vs.core

# Load source
clip = core.ffms2.Source("artifacted_source.mkv")

# Step 1: Deblocking
clip = core.deblock.Deblock(clip, quant=20)

# Step 2: Debanding
clip = core.f3kdb.Deband(clip, range=18, y=64, cb=64, cr=64, grainy=16, grainc=16)

# Step 3: Deringing
clip = core.dering.Dering(clip, strength=30)

# Step 4: Mosquito Noise Reduction
clip = core.hqdn3d.HQDenoise3D(clip, luma_spatial=4.0, luma_temporal=6.0)

# Output
clip.set_output()

Conclusion

Artifact reduction requires a keen eye and patience. Each type of artifact demands specific techniques, and combining them thoughtfully will yield clean, high-quality results. Always preview your changes and test on small clips before committing to a full encode.