FFmpeg Motion Interpolation: How to Reduce Artifacts

This article provides a practical guide on configuring motion-compensated frame interpolation in FFmpeg using the minterpolate filter. You will learn how to adjust key parameters—such as motion estimation algorithms, block sizes, and scene detection thresholds—to smoothly increase video frame rates while minimizing distracting visual artifacts.

Understanding the minterpolate Filter

FFmpeg uses the minterpolate filter to synthesize new frames between existing ones. By default, naive frame duplication or blending causes stutter or blur. Motion-compensated interpolation (MCI) tracks pixels across frames to reconstruct intermediate motion, but incorrect settings can lead to “halo” effects, warping, and blocky artifacts.

To enable motion compensation, your basic filter chain must specify the target frame rate (fps) and set the motion interpolation mode (mi_mode) to mci:

-vf "minterpolate=fps=60:mi_mode=mci"

Advanced Configurations to Minimize Artifacts

While the default settings provide a starting point, they often struggle with complex motion. Use the following parameters to fine-tune the filter and eliminate rendering errors.

1. Enable Scene Change Detection (scd)

One of the most jarring artifacts occurs when FFmpeg tries to interpolate frames across a camera cut, resulting in a surreal, morphing transition. You must configure scene change detection to force the filter to blend or drop frames at cuts instead of interpolating them.

2. Choose the Right Motion Estimation Mode (me_mode)

FFmpeg offers two primary modes for estimating motion: * bidir (Bidirectional): Estimates motion both forward and backward. It is computationally cheaper but prone to halo artifacts around fast-moving foreground objects. * bilat (Bilateral): Estimates motion geometrically between frames. While significantly slower, bilateral estimation produces much cleaner edges and fewer warping artifacts. Use me_mode=bilat for high-quality results.

3. Adjust Macroblock Size (mb_size)

The video frame is divided into macroblocks to track motion. * The default size is 16 pixels. * Decreasing the block size to 8 (mb_size=8) allows FFmpeg to track smaller, more intricate movements (like moving hair or fingers), which reduces blocky artifacts. However, setting this too low can introduce noise in high-detail backgrounds.

4. Optimize the Motion Estimation Algorithm (me)

The search algorithm determines how FFmpeg locates matching blocks between frames. * epzs (Enhanced Predictive Zonal Search): The default option. It offers a great balance between speed and quality. * esa (Exhaustive Search Algorithm): Searches every possible combination. It is extremely slow but yields the highest mathematical precision, which can occasionally resolve micro-stuttering artifacts.

5. Control Search Parameter Range (search_param)

The search_param value defines the search centering radius for motion vectors. For fast-moving action videos (sports, gaming), increase the search parameter from the default 32 to 64 or 128. This prevents the algorithm from “losing track” of fast objects, which otherwise causes severe warping.


Optimized FFmpeg Command

Combining these configurations results in an optimized command line designed to maximize smoothness while suppressing visual artifacts:

ffmpeg -i input.mp4 -vf "minterpolate=fps=60:mi_mode=mci:me_mode=bilat:me=epzs:mb_size=8:search_param=64:scd=fd:scd_threshold=3.5" -c:v libx264 -crf 20 -preset slow output.mp4

Parameter Breakdown: