Denoise
This section is in need of contributions. If you believe you can help, please see our Contribution Guide to get started as a contributor!
Overviewâ
Denoising involves removing random noise from the video. Such noise can result from film grain, signal interference or simply low light conditions. In any case, noise can greatly reduce compression efficiency especially if the video codec doesn't support film grain synthesis.
In FFmpeg there are two filters available for denoising:
hqdn3dâ
hqdn3d is a fast, high quality 3d denoising filter which improves compressibility. Can be applied to images and videos.
Usageâ
ffmpeg -i input.mp4 -vf hqdn3d output.mp4
The default configuration should be fine for most use cases.
If you still see too much noise you can adjust the luma_spatial
parameter (other parameters are derived from it by default). Higher luma_spatial
value will result in stronger denoising. By default it is set to 4
.
ffmpeg -i input.mp4 -vf hqdn3d=8 output.mp4
# which is the same as
ffmpeg -i input.mp4 -vf hqdn3d=8:6:12:9 output.mp4
Setting luma_spatial
to larger values could result in ghosting and banding artifacts.
For description of all four parameters take a look here.
nlmeansâ
nlmeans uses Non-Local Means algorithm to do denoising. Each pixel is compared to similar pixels based on their surroundings (context). The size of such context is expressed as r
xr
.
The filter is rather slow and doesn't parallelize well. Only use it in cases the video contains a lot of noise or you need very high quality denoising. In all other cases hqdn3d will be more efficient.
Usageâ
ffmpeg -i input.mp4 -vf nlmeans output.mp4
The default configuration should be fine for most use cases.
ffmpeg -i input.mp4 -vf nlmeans=s=3.0:r=31:p=15 output.mp4
Stronger denoising with larger research and patch size. Might be useful for ultra high quality denoising in 4K+ resolutions but you might struggle to achieve even 0.1 fps.
ffmpeg -i input.mp4 -vf nlmeans=s=1.0:r=5:p=3 output.mp4
Prioritize speed over quality.
Parametersâ
s
- Denoising Strength where1.0
is the lightest and also the default and the strongest is30.0
although I wouldn't recommend going above10.0
.r
- Research Size where15
is the default, it must be an odd number ranging from0
to99
. The higher the value, the slower denoising will be.p
- Research Size where7
is the default and, it must be an odd number ranging from0
to99
.
For description of all possible parameters take a look here.