How to Use FFmpeg hqdn3d Filter for Denoising
This article provides a practical guide on how to use the
hqdn3d (High-Quality 3D) filter in FFmpeg to reduce video
noise. You will learn how this spatial-temporal denoiser works,
understand its syntax and parameters, and see real-world command-line
examples ranging from subtle noise reduction to aggressive
filtering.
What is the hqdn3d Filter?
The hqdn3d filter is a highly efficient 3D denoiser
built into FFmpeg. The “3D” aspect refers to its ability to perform both
spatial denoising (reducing noise within a single
frame) and temporal denoising (reducing noise by
comparing consecutive frames over time). By combining these two methods,
hqdn3d effectively smooths out grain and compression
artifacts while preserving motion and image details better than 2D-only
filters.
Parameter Syntax
The filter accepts up to four optional parameters, separated by colons:
hqdn3d=luma_spatial:chroma_spatial:luma_tmp:chroma_tmp
luma_spatial(Default:4.0): Controls the strength of spatial denoising on the brightness (luma) channel. Higher values smooth out details within a frame.chroma_spatial(Default:3.0): Controls spatial denoising on the color (chroma) channels.luma_tmp(Default:6.0): Controls the strength of temporal denoising on the luma channel. Higher values reduce flickering/noise across frames but can cause motion ghosting if set too high.chroma_tmp(Default:4.5): Controls temporal denoising on the chroma channels. If omitted, it automatically scales based on theluma_tmpvalue.
Practical FFmpeg Examples
To apply the filter, you must pass it to FFmpeg’s video filter flag
(-vf).
1. Default Denoising
If you do not specify any parameters, FFmpeg will apply the default values, which offer a balanced, moderate level of noise reduction.
ffmpeg -i input.mp4 -vf hqdn3d output.mp42. Mild Denoising (Preserving Detail)
For high-quality source videos with only a light amount of camera hiss or sensor noise, use lower values to prevent losing fine textures.
ffmpeg -i input.mp4 -vf hqdn3d=2.0:1.5:3.0:2.5 output.mp43. Heavy Denoising (For Low-Light or VHS Rips)
If you are dealing with very noisy footage, such as analog tape captures or low-light digital video, increase the parameters. Note that this may introduce slight motion blur or “ghosting” in fast-moving scenes.
ffmpeg -i input.mp4 -vf hqdn3d=8.0:6.0:12.0:9.0 output.mp44. Denoising Chroma (Color) Only
Sometimes, a video has clean luminance but suffers from heavy color
blotches (chroma noise). You can target only the chroma channels by
setting the luma parameters to 0.
ffmpeg -i input.mp4 -vf hqdn3d=0:4.0:0:6.0 output.mp4Tips for Best Results
- Avoid Over-Filtering: Setting spatial parameters too high will make the video look plastic or “washed out.” Always start with the defaults and adjust incrementally.
- Watch for Ghosting: If moving objects leave trails
behind them, your temporal settings (
luma_tmpandchroma_tmp) are set too high. Lower them to restore sharp motion. - Filter Placement: Always place the
hqdn3dfilter before any scaling or compression in your filter chain to ensure it processes the rawest version of the noise.