Programster's Blog

Tutorials focusing on Linux, programming, and open-source

FFmpeg - Create Smooth Videos With Frame Interpolation

This tutorial will show you how you can create smooth videos (e.g. 60fps) by creating interpolated frames between existing frames with the use of FFmpeg.

In the past, I have used Butterflow to create smooth videos through frame interpolation. Unfortunately, I could only ever get that installed on Ubuntu 16.04 and nothing later.

Also, it is worth noting that this is very different from something like SVP which is all about creating the smooth playback by performing the interpolation in real-time during playback. Doing this requires a lot of CPU/GPU horsepower whilst playing back the video, whereas a pre-created video can take a lot longer to make, and then be played back on devices such as phones which don't have this software or processing power.

Steps

After having installed ffmpeg, I run the following command to create smooth videos at 60fps. The key part is the minterpolate filter.

ffmpeg \
  -i input.mp4 \
  -crf 10 \
  -vf "minterpolate=fps=60:mi_mode=mci:mc_mode=aobmc:me_mode=bidir:vsbmc=1" \
  output.60fps.mp4

Single Threaded

Unfortunately, this can only run on a single thread, hence I am using a low CRF and not performing two-pass encoding. My strategy is to create a fairly uncompressed smooth video, and then run a 2-pass HEVC encode on the result in order to get the filesize down.

For longer videos, I will break them up into smaller chunks, process those in parallel, and stitch them back together.

Alternative Method - Motion Blur

The previous command showed you how to use the minterpolate filter to create the interpolated frames. This is because if you are trying to do this for something like a movie/anime, it is probably what you want.

If you are happy with just motion-blur, this can be done much more quickly with:

ffmpeg \
  -i input.mp4 \
  -crf 10 \
  -filter:v tblend -r 60 \
  output.60fps.mp4

Examples

Below are the results of encoding the original video shown, with the blend and minterpolate filters. These videos are mp4, so you will need to be using a browser such as Chrome or Firefox.

Original

minterpolate

Tblend

References

Last updated: 20th April 2024
First published: 17th September 2021