How to Use FFmpeg hqdn3d Filter to Denoise Video
Video noise, often seen as grain or fuzziness in low-light footage,
can drastically reduce the quality and compressibility of your files.
FFmpeg provides a highly effective solution with the hqdn3d
(High Quality Denoise 3D) filter, which performs 3D denoising by
smoothing out noise both within individual frames (spatial) and across
consecutive frames (temporal). This guide covers how the
hqdn3d filter works, explains its key parameters, and
provides practical command-line examples to help you clean up your
videos.
Understanding the hqdn3d Parameters
The hqdn3d filter accepts four optional parameters,
formatted as follows:
hqdn3d=luma_spatial:chroma_spatial:luma_tmp:chroma_tmp
- luma_spatial (Default: 4.0): Controls the strength of brightness (luma) denoising within a single frame. Higher values blur spatial details more.
- chroma_spatial (Default: 3.0): Controls the strength of color (chroma) denoising within a single frame.
- luma_tmp (Default: 6.0): Controls the strength of brightness denoising across consecutive frames over time.
- chroma_tmp (Default: 4.5): Controls the strength of color denoising across consecutive frames over time.
As a general rule, temporal parameters (luma_tmp and
chroma_tmp) should be slightly higher than spatial
parameters to prevent a “plastic” or overly blurry look, as temporal
denoising preserves fine static details better than spatial
denoising.
Practical Command Examples
1. Applying Default Denoising
If you do not specify any parameters, FFmpeg will use the default settings. This is a great starting point for moderate video noise.
ffmpeg -i input.mp4 -vf hqdn3d -c:a copy output.mp42. Light Denoising (Preserving Detail)
For high-definition videos with only minor noise, use lower values to prevent losing sharp details and textures.
ffmpeg -i input.mp4 -vf hqdn3d=2:1.5:3:2.25 -c:a copy output.mp43. Heavy Denoising (For Low-Light or VHS Footage)
For highly pixelated, low-light, or analog VHS rips, you will need stronger filtering. Note that values this high may introduce “ghosting” artifacts behind moving objects.
ffmpeg -i input.mp4 -vf hqdn3d=8:6:12:9 -c:a copy output.mp44. Denoising Only Chroma (Color Noise)
If your video has color blotches or chromatic noise but you want to keep the brightness details intact, you can set the luma parameters to zero.
ffmpeg -i input.mp4 -vf hqdn3d=0:3:0:4.5 -c:a copy output.mp4Tips for Best Results
- Avoid Over-Filtering: Setting the values too high will result in a “soap opera” or “wax” effect where human skin loses all texture and fast-moving objects leave trails.
- Performance: The
hqdn3dfilter is highly optimized and run on the CPU. It is generally faster than more complex denoising filters likenlmeans, making it ideal for real-time streaming or batch processing. - Combine with Encoding: Denoised video is much
easier for video encoders (like x264 or x255) to compress. Running
hqdn3dwill often result in a significantly smaller output file size at the same visual quality.