FFmpeg minterpolate Custom Motion Estimation Guide
The minterpolate filter in FFmpeg allows you to perform
motion-compensated frame rate conversion to create smooth slow-motion
effects or increase a video’s frame rate. This guide explains how to
configure and customize the filter’s underlying motion estimation (ME)
engines—such as EPZS, UMH, and ESA—and adjust advanced parameters like
macroblock size, search range, and motion compensation modes to optimize
the balance between video quality and rendering speed.
Enabling Motion Compensation
To customize the motion estimation engine, you must first set the
motion interpolation mode (mi_mode) to Motion Compensated
Interpolation (mci). When mi_mode=mci is
enabled, FFmpeg uses motion vectors to predict and generate intermediate
frames.
The basic syntax for the filter is:
-vf "minterpolate=fps=60:mi_mode=mci"Selecting a Motion Estimation Engine
The me parameter allows you to choose the specific
motion estimation engine (algorithm) used to scan frames and calculate
motion vectors.
Specify the engine using the me option. The following
engines are supported:
epzs(Enhanced Predictive Zonal Search): The default engine. It offers the best balance of speed and accuracy for most use cases.esa(Exhaustive Search Algorithm): Scans every possible block combination within the search range. It is mathematically the most accurate engine but is extremely slow and CPU-intensive.umh(Uneven Multi-Hexagon Search): A high-quality alternative to ESA that uses a multi-hexagon pattern to find motion vectors quickly without sacrificing much accuracy.hex(Hexagon Search): Uses a hexagonal search pattern. Faster than UMH but slightly less accurate.ds(Diamond Search): Uses a diamond-shaped search pattern. Highly speed-optimized but prone to missing complex motion.tss(Three Step Search) /fss(Four Step Search): Multi-step search patterns optimized for legacy workloads.
Fine-Tuning Motion Estimation Parameters
You can customize how your chosen motion estimation engine behaves using the following parameters:
1. Motion Estimation Mode
(me_mode)
Controls the direction of the motion search. *
bilat (Bilateral): Estimates motion from
past to future frames and future to past frames simultaneously. This is
the default and yields the smoothest results. *
bidir (Bidirectional): Estimates motion
for block matching individually in both directions.
2. Macroblock Size
(mb_size)
Defines the size of the macroblocks (in pixels) used for estimation.
* Default: 16 (16x16 pixels). *
Customization: Setting mb_size=8 improves
accuracy for small, fast-moving objects but significantly increases
processing time.
3. Search Parameter
(search_param)
Defines the search window radius in pixels. *
Default: 32. *
Customization: Increase this value (e.g.,
search_param=64) for videos with fast-moving subjects
across the screen to prevent ghosting or warping artifacts.
4. Variable-Size
Block Motion Compensation (vsbmc)
Enables the engine to dynamically split macroblocks into smaller
sub-blocks when complex motion is detected. * Default:
0 (Disabled). * Customization: Set
vsbmc=1 to improve edge rendering around moving objects at
the cost of processing speed.
Practical Examples
High-Quality Configuration (Using UMH Engine)
This configuration uses the Uneven Multi-Hexagon engine, a 64-pixel search radius, and variable-size block motion compensation for clean, artifact-free high-frame-rate output:
ffmpeg -i input.mp4 -vf "minterpolate=fps=60:mi_mode=mci:me_mode=bilat:me=umh:search_param=64:vsbmc=1" output.mp4Maximum Precision Configuration (Using ESA Engine)
Use this option only for short clips or when render time is not a constraint. It uses the Exhaustive Search Algorithm with small 8x8 macroblocks:
ffmpeg -i input.mp4 -vf "minterpolate=fps=60:mi_mode=mci:me=esa:mb_size=8:search_param=32" output.mp4Fast and Efficient Configuration (Using EPZS Engine)
This setup relies on the default EPZS engine but optimizes macroblock size and enables bilateral searching for rapid processing:
ffmpeg -i input.mp4 -vf "minterpolate=fps=60:mi_mode=mci:me=epzs:me_mode=bilat:search_param=16" output.mp4