How to Use FFmpeg tmedian Filter for Noise Reduction

This guide explains how to use the FFmpeg tmedian filter to apply a temporal median filter to your videos. You will learn the basic syntax, key parameters for controlling the filter’s strength, and practical command-line examples to achieve effective progressive noise reduction while preserving spatial details.

Understanding the tmedian Filter

The tmedian (Temporal Median) filter in FFmpeg reduces video noise by comparing pixels across consecutive frames (temporally) rather than within a single frame (spatially). For each pixel, the filter looks at the same coordinate across a sequence of frames, sorts the color values, and outputs the median value.

This approach is highly effective for removing random, fast-moving noise—such as sensor hiss, film grain, or digital artifacts—without blurring the fine details of static objects.

Basic Syntax and Parameters

The basic syntax for applying the tmedian filter in an FFmpeg command is:

ffmpeg -i input.mp4 -vf tmedian=radius=1 output.mp4

The filter accepts several key parameters to customize its behavior:

Practical Examples

1. Light Noise Reduction (Default Settings)

For mild digital noise, a radius of 1 or 2 is usually sufficient. This keeps processing fast and minimizes motion artifacts.

ffmpeg -i input.mp4 -vf "tmedian=radius=1" -c:a copy output.mp4

2. Strong Noise Reduction for Static Scenes

If you are processing security footage or a static camera shot with heavy noise, you can increase the radius to analyze more frames.

ffmpeg -i input.mp4 -vf "tmedian=radius=4" -c:a copy output.mp4

Note: A radius of 4 analyzes 9 frames in total (the current frame plus 4 frames before and 4 frames after).

3. Noise Reduction on the Luma Plane Only

To reduce brightness noise while leaving color data untouched, target only the luma channel (plane 0).

ffmpeg -i input.mp4 -vf "tmedian=radius=2:planes=1" -c:a copy output.mp4

Tips for Best Results