How to Denoise Low-Light Video with FFmpeg hqdn3d
This article provides a straightforward guide on how to use FFmpeg’s
hqdn3d (High Quality Denoise 3D) filter to reduce noise in
low-light videos. You will learn the syntax for adjusting both spatial
and temporal denoising parameters to clean up grainy footage while
preserving video quality and avoiding motion artifacts.
Understanding the hqdn3d Filter
The hqdn3d filter is a three-dimensional denoiser that
filters both spatially (within a single frame) and temporally (across
multiple frames). It is highly effective for low-light videos, which
often suffer from “boiling” sensor noise or high-ISO grain.
The filter accepts four parameters in the following order:
hqdn3d=luma_spatial:chroma_spatial:luma_tmp:chroma_tmp
- luma_spatial: Spatial denoising strength for brightness (default: 4.0).
- chroma_spatial: Spatial denoising strength for color (default: 3.0).
- luma_tmp: Temporal denoising strength for brightness (default: 6.0).
- chroma_tmp: Temporal denoising strength for color (default: 4.5).
The Command for Low-Light Denoising
Because low-light noise fluctuates heavily from frame to frame, you need stronger temporal filtering to smooth out the noise over time.
Here is the recommended FFmpeg command for low-light video:
ffmpeg -i input.mp4 -vf "hqdn3d=4.0:3.0:10.0:7.5" -c:v libx264 -crf 18 -c:a copy output.mp4Parameter Breakdown:
-i input.mp4: Specifies your source video file.-vf "hqdn3d=4.0:3.0:10.0:7.5": Applies the denoise filter.- The spatial parameters (
4.0and3.0) are kept at default values to prevent the image from looking too blurry or losing sharp details. - The temporal parameters are boosted to
10.0(for luma) and7.5(for chroma) to aggressively target the moving grain characteristic of low-light footage.
- The spatial parameters (
-c:v libx264 -crf 18: Re-encodes the video using the H.264 codec at a high-quality constant rate factor (CRF) of 18, ensuring the denoised output does not suffer from compression artifacts.-c:a copy: Copies the audio stream without re-encoding it to save time.
Fine-Tuning the Settings
If you experience issues with the output, you can adjust the values based on your footage:
- If the video looks “ghostly” or has motion trails:
Your temporal values are too high. Reduce
luma_tmpto8.0andchroma_tmpto6.0. - If the video is still too grainy: Increase the
spatial values slightly (e.g.,
hqdn3d=6.0:4.5:10.0:7.5), but be aware that higher spatial values will make the video look softer and less detailed.