Programster's Blog

Tutorials focusing on Linux, programming, and open-source

Ubuntu 16.04 - Install Butterflow

This tutorial is for Ubuntu 16.04 and will not work on Ubuntu 18.04 which uses OpenCV 3 instead of 2.4.

Butterflow is an open source tool that utilizes ffmpeg in order to encode a smoother version of a video file by interpolating frames. The result is a video with a higher frame-rate which results in smoother viewing-pans (the view slowly going side to side or up-and-down). Some people don't like this because it also has the "Soap Opera Effect". This tutorial will show you how to install it on Ubuntu 16.04 and get you started with using it.

Encoding a new version of the video can take quite a while, and may take many attempts before you are happy with the final result. I no longer bother re-encoding my files, and the SVP tool to interpolate the frames on the fly instead. However, this will require viewing the content on a computer with a good CPU, rather than a low-powered Android or iOS device. Butterflow makes use of OpenCL in order to perform the video interpolation and it takes quite some time. If you don't have a dedicated GPU, there is no point in you installing this tool.


Execute the following script to install Butterflow.

cd $HOME

# Install dependencies
sudo apt-get install \
git virtualenv python-dev \
ocl-icd-opencl-dev libopencv-dev \
python-opencv ffmpeg python-pip -y

git clone

virtualenv -p /usr/bin/python2 butterflow

echo "/usr/lib/python2.7/dist-packages" > $HOME/butterflow/lib/python2.7/site-packages/butterflow.pth


cd $HOME/butterflow
git checkout 0.2.3
sudo python install

After the script has finished executing, you can use the following command to check your OpenCL devices

butterflow -d

and you should get something like:

OpenCL devices:
  Platform              : NVIDIA CUDA
  Platform Vendor       : NVIDIA Corporation
  Platform Version      : OpenCL 1.2 CUDA 8.0.0
    Device          : GeForce GTX 970
      Version       : OpenCL 1.2 CUDA
      Version       : 367.44

Using Butterflow

Below are some example commands to use Butterflow, but to roll your own just read the output of butterflow -h

Give a video twice the framerate:

butterflow -r 2x [input-file]

Give a video twice the framerate and preview it.

butterflow -r 2x [input-file] -p

Configure butterflow for smooth motion by emphasizing blended frames over warping pixels.

butterflow -r 2x [input-file] -sm

Have butterflow write to a new file rather than replacing your existing file:

butterflow -r 2x [input-file] -o [output file]

I found that I could not specify a .mkv extension but had to use .mp4


Last updated: 4th February 2020
First published: 16th August 2018