How to Use FFmpeg tmix Filter for Motion Blur

The tmix (temporal mix) filter in FFmpeg blends multiple consecutive video frames into a single frame, allowing you to create smooth motion blur, simulate long exposures, or generate artistic light trails. By averaging pixels across a moving temporal window, you can soften harsh motion or convert high-frame-rate footage into cinematic video with natural-looking movement.

Understanding the tmix Filter

The tmix filter operates across the time axis (temporally) rather than within a single frame (spatially). It takes two primary parameters:

  • frames: The number of successive frames to blend together. The default value is 3. Higher values increase the blur length, while lower values keep the motion sharper.
  • weights: The relative contribution of each frame in the mix. By default, all frames are weighted equally (1 1 1...). Specifying custom weights lets you control how the blur fades in or out.

Basic Uniform Motion Blur

To apply a simple motion blur across consecutive frames, specify the number of frames you want to average.

ffmpeg -i input.mp4 -vf "tmix=frames=5:weights='1 1 1 1 1'" -c:a copy output.mp4

In this command:

  • frames=5 tells FFmpeg to combine 5 consecutive frames.
  • weights='1 1 1 1 1' ensures each of the 5 frames contributes equally to the final image.
  • -c:a copy copies the audio stream without re-encoding.

Weighted Motion Blur (Decay and Trails)

Uniform weights can sometimes cause a ghosting or stuttering artifact. To simulate real camera shutter blur or a trailing effect, assign higher weights to the most recent frames and lower weights to earlier frames.

ffmpeg -i input.mp4 -vf "tmix=frames=7:weights='1 2 3 4 5 6 7'" -c:a copy output.mp4

FFmpeg automatically normalizes the weights, so you do not need to calculate fractions or ensure they add up to 1. In the example above, the latest frame receives the highest prominence, creating a gradual fade-out behind fast-moving objects.

To create a symmetrical blur centered on the middle frame, distribute the weights evenly from the center:

ffmpeg -i input.mp4 -vf "tmix=frames=5:weights='1 3 5 3 1'" -c:a copy output.mp4

Simulating Motion Blur when Reducing Frame Rates

A common use case for tmix is downsampling high-framerate footage (such as 60 fps or 120 fps) to a standard cinematic framerate (like 24 fps or 30 fps) while retaining the natural motion blur lost when simply dropping frames.

To blend frames before reducing the frame rate, place tmix before the fps filter in your filtergraph:

ffmpeg -i input_60fps.mp4 -vf "tmix=frames=3:weights='1 2 1',fps=30" -c:v libx264 -crf 18 -c:a copy output_30fps.mp4

This blends 3 adjacent frames at 60 fps to generate realistic movement dynamics, then samples the final stream down to 30 fps.

Adjusting Blur Intensity

  • Subtle Blur: Use frames=3 with balanced weights (1 2 1). This is ideal for masking micro-stutter in panning shots.
  • Medium Blur: Use frames=5 to frames=7 with a trailing weight scale for sports or fast-action footage.
  • Extreme Exposure/Light Trails: Set frames to a high number (e.g., frames=15 or higher) to simulate long-exposure photography, night-time traffic streaks, or waterfall smoothing.