FFmpeg Smooth Slow Motion Frame Interpolation

This article provides a practical guide on how to create ultra-smooth slow-motion videos using FFmpeg's built-in frame interpolation tools. You will learn the exact command-line syntax required to stretch video duration and use motion-compensated interpolation to generate the missing frames, preventing the choppy look common in standard slow-motion techniques.

To create ultra-smooth slow motion, you must perform two steps in a single FFmpeg command: slow down the video playback speed and interpolate new frames to maintain a high, fluid frame rate.

The primary tool for this is FFmpeg's minterpolate (motion interpolation) filter, combined with the setpts filter.

The Basic Command

Use the following command to slow down a video to half-speed (50% speed) and interpolate the output to a smooth 60 frames per second (fps):

ffmpeg -i input.mp4 -filter:v "setpts=2*PTS,minterpolate=fps=60:mi_mode=mci:mc_mode=aobmc:me_mode=bidir" output.mp4

Explaining the Video Filters

  • setpts=2*PTS: This slows down the video speed by a factor of 2. It multiplies the Presentation Timestamp (PTS) of each frame, stretching the video to twice its original duration. For 4x slow motion, you would use 4*PTS.
  • minterpolate: This activates the motion interpolation filter.
  • fps=60: Sets the desired output frame rate. Even though the video is stretched, FFmpeg will generate enough new frames to fill this 60 fps target.
  • mi_mode=mci: Sets the motion interpolation mode to "Motion Compensated Interpolation." This uses optical flow to analyze pixel movement and draw entirely new, transitional frames.
  • mc_mode=aobmc: Uses "Advanced Overlapped Block Motion Compensation." This setting reduces visual warping and halo artifacts around moving objects.
  • me_mode=bidir: Uses bidirectional motion estimation, which analyzes both past and future frames to calculate the intermediate frames with maximum accuracy.

Adjusting the Audio Speed

Slowing down the video using setpts does not automatically slow down the audio, which will result in out-of-sync sound. To slow down the audio to match the 50% video speed, add the atempo audio filter:

ffmpeg -i input.mp4 -filter:v "setpts=2*PTS,minterpolate=fps=60:mi_mode=mci:mc_mode=aobmc:me_mode=bidir" -filter:a "atempo=0.5" output.mp4

Note: The atempo filter value is the inverse of the PTS multiplier. If you use setpts=4*PTS (quarter speed), you must use atempo=0.25 (or chain multiple atempo filters, as a single atempo filter only supports values between 0.5 and 2.0).

Performance Considerations

Motion compensated interpolation is highly CPU-intensive. The command may take a significant amount of time to render depending on your processor, video resolution, and target frame rate. If the process is too slow, you can change mi_mode=mci to mi_mode=blend. While blend does not use optical flow to generate new frames (it simply blends adjacent frames together), it renders much faster.