How to Denoise Video with FFmpeg hqdn3d

Video noise can ruin the quality of your footage, but FFmpeg offers powerful built-in tools to clean it up. This article provides a straightforward guide on how to apply the hqdn3d (High Quality Denoise 3D) filter in FFmpeg to reduce both spatial and temporal noise, resulting in a cleaner and highly compressible output video.

Understanding the hqdn3d Filter

The hqdn3d filter is a 3D denoiser that reduces noise in two ways: * Spatial Denoising: Reduces noise within individual frames (pixels next to each other). * Temporal Denoising: Reduces noise across consecutive frames (pixels in the same spot over time).

By combining these two methods, hqdn3d effectively smooths out grain and compression artifacts without causing significant motion blur.

The Basic Command

To apply the default denoising settings to a video, use the following FFmpeg command:

ffmpeg -i input.mp4 -vf "hqdn3d" -c:a copy output.mp4

In this command: * -i input.mp4 specifies your noisy source file. * -vf "hqdn3d" applies the video filter with default settings. * -c:a copy copies the audio track directly without re-encoding to save time. * output.mp4 is your clean video file.

Adjusting Denoise Strength

You can customize the intensity of the denoising effect by passing up to four parameters to the filter. The syntax is:

hqdn3d=luma_spatial:chroma_spatial:luma_tmp:chroma_tmp

Example: Light Denoising

If your video only has a small amount of noise, use lower values to prevent the video from looking too soft or blurry:

ffmpeg -i input.mp4 -vf "hqdn3d=2.0:1.5:3.0:2.25" -c:a copy output.mp4

Example: Heavy Denoising

For very grainy or low-light footage, you can increase the values. Be aware that high values can create a “soap opera” effect or cause motion ghosting:

ffmpeg -i input.mp4 -vf "hqdn3d=8.0:6.0:12.0:9.0" -c:a copy output.mp4

Best Practices