What You Will Learn
- Commands to enhance sharpness with the
unsharpfilter - How to use
unsharpas a blur filter - How to configure the luma and chroma matrices independently
- Guidelines for tuning the parameters
Tested with: FFmpeg 6.1 (verified against real FFmpeg)
Supported OS: Windows / macOS / Linux
Basic Commands
Enhance Sharpness
ffmpeg -i input.mp4 -vf "unsharp=5:5:1.0:5:5:0.0" output.mp4
The argument order is lx:ly:la:cx:cy:ca. A value of la=1.0 (luma strength) increases sharpness.
Apply a Soft Blur (Use as a Blur)
ffmpeg -i input.mp4 -vf "unsharp=5:5:-1.0:5:5:0.0" output.mp4
Setting la to a negative value produces a blur. If you just need a plain, uniform softening, a box blur is lighter and easier to dial in.
Parameter Details
unsharp=lx:ly:la:cx:cy:ca
| Parameter | Meaning | Default | Range |
|---|---|---|---|
lx | Luma matrix X width (odd) | 5 | 3–23 |
ly | Luma matrix Y width (odd) | 5 | 3–23 |
la | Luma strength (positive = sharpen, negative = blur) | 1.0 | -2.0–5.0 |
cx | Chroma matrix X width (odd) | 5 | 3–23 |
cy | Chroma matrix Y width (odd) | 5 | 3–23 |
ca | Chroma strength (positive = sharpen, negative = blur) | 0.0 | -2.0–5.0 |
The matrix widths must be odd numbers (3, 5, 7, 9, …).
Sharpen Luma Only, Leave Chroma Unchanged (Recommended)
ffmpeg -i input.mp4 -vf "unsharp=7:7:1.5:5:5:0.0" output.mp4
With ca=0.0, the chroma is left unchanged. This produces the most natural-looking result. A light luma-only sharpen also helps tighten the soft edges left after green-screen compositing with chromakey.
Strong Sharpening (For Action Footage)
ffmpeg -i input.mp4 -vf "unsharp=3:3:2.0:3:3:0.0" output.mp4
Shrinking the matrix while raising the strength makes the edges stand out for a crisp, sharp look.
Soft Blur (For Portraits)
ffmpeg -i input.mp4 -vf "unsharp=13:13:-0.5:5:5:0.0" output.mp4
Widening the matrix and using a negative value yields a soft, gentle blur.
How the Unsharp Mask Works
The unsharp filter uses the unsharp mask (USM) algorithm.
- Generate a “blurred image” by applying a Gaussian blur to the original.
- Subtract the blurred image from the original to extract the “edge component.”
- Add the edge component back to the original at the strength given by
la.
A negative la subtracts the edge component, which produces a blur effect.
Applying to Still Images
ffmpeg -i input.jpg -vf "unsharp=5:5:1.5:5:5:0.0" output.jpg
Common Settings Compared
| Use Case | Example Command |
|---|---|
| Standard sharpen | unsharp=5:5:1.0:5:5:0.0 |
| Strong sharpen | unsharp=3:3:2.0:3:3:0.0 |
| Light sharpen | unsharp=7:7:0.5:5:5:0.0 |
| Soft blur | unsharp=9:9:-0.5:5:5:0.0 |
| Strong blur | unsharp=13:13:-1.5:5:5:0.0 |
What Not to Do
Bad example: specifying even numbers for the matrix widths
ffmpeg -i input.mp4 -vf "unsharp=6:6:1.0:6:6:0.0" output.mp4
The matrix widths (lx, ly, cx, cy) must be odd numbers. Specifying even numbers results in an error.
Measured Example
This example applies standard sharpening to a 1080p/30fps, 2-minute H.264 video:
ffmpeg -i input.mp4 \
-vf "unsharp=5:5:1.0:5:5:0.0" \
-c:v libx264 -crf 23 -preset medium -c:a copy \
output.mp4
unsharp reads neighboring pixels, so it is heavier than simple color filters such as eq or hue. On a typical 8-core desktop, processing may take roughly 1.5–3x real time.
File size can increase. Sharpening emphasizes detail and noise, which gives the encoder more information to preserve. Noisy dark footage can grow by around 5–15% at the same CRF. Starting around la=0.5 and increasing gradually is safer than jumping to a strong setting.
For already sharpened smartphone footage, strong unsharp can create white or black halos around fine edges. Check text, hair, buildings, and moving shots at 100% view. For noisy sources, a light denoise pass before weak sharpening is often more stable. Results vary by environment.