Adjust CAS Filter Sharpening in FFmpeg
The Contrast Adaptive Sharpen (CAS) filter in FFmpeg is an effective
tool for enhancing image details and clarity without introducing
unwanted halos or artifacts. This article explains how to adjust the
sharpening strength of the cas filter using its primary
parameter, complete with practical command-line examples to help you
achieve the perfect level of sharpness for your videos.
Understanding the CAS Filter Parameter
The sharpening strength of the cas filter in FFmpeg is
controlled by a single parameter:
amount.
- Parameter Name:
amount - Value Range:
0.0to1.0 - Default Value:
0.0(No sharpening applied)
A value of 0.0 leaves the image unchanged, while
1.0 applies the maximum level of sharpening. For most video
sources, a value between 0.3 and 0.6 provides
a noticeable boost in clarity without looking over-processed.
Command Syntax and Examples
To apply the filter, use the -vf (video filter) flag
followed by cas and your desired amount
value.
1. Standard Syntax
You can explicitly define the amount parameter in the
filter chain:
ffmpeg -i input.mp4 -vf "cas=amount=0.5" -c:a copy output.mp42. Shorthand Syntax
If you are only adjusting the strength, you can omit the parameter name and simply provide the numerical value:
ffmpeg -i input.mp4 -vf "cas=0.5" -c:a copy output.mp43. Recommended Strength Levels
Light Sharpening (Subtle enhancement for high-quality sources):
ffmpeg -i input.mp4 -vf "cas=0.2" -c:a copy output.mp4Moderate Sharpening (Best overall balance for 1080p/4K content):
ffmpeg -i input.mp4 -vf "cas=0.5" -c:a copy output.mp4Aggressive Sharpening (For blurry or upscaled videos):
ffmpeg -i input.mp4 -vf "cas=0.8" -c:a copy output.mp4
Combining CAS with Other Filters
If you are using the cas filter alongside other video
filters (such as scaling), separate them with a comma. It is generally
recommended to apply sharpening after scaling your video:
ffmpeg -i input.mp4 -vf "scale=1920:1080,cas=0.5" -c:a copy output.mp4