How to Use yaepblur Filter in FFmpeg

The yaepblur (Yet Another Edge-Preserving Blur) filter in FFmpeg provides an effective way to smooth out video noise, grain, and subtle surface textures while keeping prominent edges and fine boundaries crisp. This guide covers the syntax, core parameters, and practical command-line examples needed to implement and fine-tune edge-preserving blur in your video processing workflows.

Understanding the yaepblur Filter

Unlike standard gaussian or box blur filters that uniformly soften an entire frame, edge-preserving filters calculate pixel variance within a local neighborhood. If the contrast between adjacent pixels exceeds a specified threshold, the filter treats the area as an edge and preserves it, preventing the smearing of critical visual details.

Filter Parameters

The yaepblur filter accepts three primary options:

  • radius (or r): Sets the radius of the blur window in pixels. A higher radius analyzes a larger area around each pixel, creating a wider blur effect at the cost of processing speed. The default value is 3.
  • sigma (or s): Controls the edge-detection threshold. A lower sigma value strictly restricts the blur to areas of minimal contrast (flat surfaces), leaving more edges untouched. A higher sigma causes the filter to treat higher-contrast transitions as flat areas, blurring across stronger edges. The default value is 128.
  • planes (or p): Defines which color planes the filter is applied to. It accepts a bitmask integer:
    • 1: Luma (Y) only (default).
    • 7: All YUV planes (Luma + Chroma).
    • 15: All planes including Alpha.

Basic Usage

To apply a standard edge-preserving blur using default settings, specify yaepblur within the -vf (video filter) argument:

ffmpeg -i input.mp4 -vf "yaepblur" -c:a copy output.mp4

Practical Examples

1. Subtle Skin Smoothing or Denoising

To reduce video noise or subtle facial imperfections without softening structural lines, use a small radius and a moderate sigma:

ffmpeg -i input.mp4 -vf "yaepblur=radius=2:sigma=64" -c:v libx264 -crf 18 -c:a copy output.mp4

2. Strong Cartoon or Posterization-Style Smoothing

To create a stylized, flatter look with sharp borders, increase both the radius and the sigma:

ffmpeg -i input.mp4 -vf "yaepblur=radius=8:sigma=180" -c:v libx264 -crf 18 -c:a copy output.mp4

3. Filtering All Color Planes

By default, yaepblur processes only the luma channel (planes=1). To process chroma channels as well to eliminate color noise:

ffmpeg -i input.mp4 -vf "yaepblur=r=4:s=120:p=7" -c:v libx264 -crf 18 -c:a copy output.mp4

Performance Tips

  • Radius Scaling: The computational complexity scales significantly with larger radius values. For general denoising, keep the radius between 2 and 5.
  • Luma-Only Processing: Leaving planes=1 (the default) saves processing overhead because the human eye is most sensitive to luma resolution, often making chroma filtering unnecessary.