FFmpeg Unsharp Filter: Box and Gaussian Sharpening

This guide explains how to use the FFmpeg unsharp filter to enhance video clarity using box or Gaussian sharpening techniques. You will learn the exact syntax of the filter, the role of each parameter (such as matrix size and sharpening amount), and see practical command-line examples for applying sharpening to both the luma (brightness) and chroma (color) channels of your videos.

Understanding the Unsharp Filter Syntax

The unsharp filter in FFmpeg works by applying a blur to the video (using a fast box-blur approximation of a Gaussian blur) and subtracting it from the original image to detect edges and increase contrast.

The basic syntax for the filter is:

unsharp=luma_msx:luma_msy:luma_amount:chroma_msx:chroma_msy:chroma_amount

You can also use named parameters for better readability:

unsharp=l_msx=5:l_msy=5:l_amount=1.0:c_msx=0:c_msy=0:c_amount=0

Parameter Breakdown


Practical Examples

1. Default Gaussian-Like Sharpening (Luma Only)

For most standard video sharpening tasks, you only want to sharpen the luma channel to avoid color distortion. The following command uses a 5x5 matrix with a moderate strength of 1.0:

ffmpeg -i input.mp4 -vf "unsharp=5:5:1.0:0:0:0" -c:a copy output.mp4

2. Subtle Sharpening for High-Resolution Video (1080p / 4K)

When dealing with high-resolution footage, a larger matrix size is required to make the sharpening visible. This command uses a 7x7 matrix with a subtle strength of 0.6:

ffmpeg -i input.mp4 -vf "unsharp=l_msx=7:l_msy=7:l_amount=0.6" -c:a copy output.mp4

3. Strong Box/Gaussian Sharpening

If your video is noticeably blurry, you can increase the matrix size and sharpening amount. Use this with caution, as high values can introduce “halos” around high-contrast edges:

ffmpeg -i input.mp4 -vf "unsharp=l_msx=9:l_msy=9:l_amount=1.5" -c:a copy output.mp4

4. Sharpening Both Luma and Chroma

If you want to sharpen both the details and the color boundaries of the video, you can apply a smaller matrix size and lower amount to the chroma channels:

ffmpeg -i input.mp4 -vf "unsharp=5:5:0.8:3:3:0.4" -c:a copy output.mp4

Tips for Best Results