How to Use FFmpeg lagfun Filter for Temporal Lag

This guide explains how to use the lagfun filter in FFmpeg to apply a temporal lag or motion blur effect to your videos. You will learn the core syntax, key parameters of the filter, and practical command-line examples to help you customize the intensity of the trailing, ghostly visual effect.

Understanding the lagfun Filter

The lagfun filter in FFmpeg is a temporal video filter that blends the current frame with previous frames. This process creates a trailing “ghost” effect on moving objects while leaving static backgrounds unaffected. It is highly effective for simulating long-exposure motion, psychedelic visual effects, or stylized motion blur.

Key Parameters

The lagfun filter accepts two primary parameters to control the output:

Practical Command Examples

To apply the filter with its default settings, use the following command:

ffmpeg -i input.mp4 -vf "lagfun" output.mp4

To increase the trail duration and make the motion blur highly pronounced, increase the decay parameter closer to 1.0:

ffmpeg -i input.mp4 -vf "lagfun=decay=0.98" output.mp4

For a fast-fading, subtle lag effect that only slightly softens fast motion, reduce the decay parameter:

ffmpeg -i input.mp4 -vf "lagfun=decay=0.75" output.mp4

If you want to apply the lag effect only to the brightness (luma) plane while keeping the color (chroma) planes sharp, target only the first plane:

ffmpeg -i input.mp4 -vf "lagfun=decay=0.95:planes=1" output.mp4