Programster's Blog

Tutorials focusing on Linux, programming, and open source

Ubuntu 16.04 - Install Butterflow

Butterflow is an open source tool that utilized ffmpeg to create smooth video by interpolating frames. This is often referred to as the "Soap Opera Effect". This tutorial will show you how to install it on Ubuntu 16.04 and get you started with using it.

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.

Installation

Execute the following script to install Butterflow.

#!/bin/bash
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 https://github.com/dthpham/butterflow.git

virtualenv -p /usr/bin/python2 butterflow

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

deactivate

cd $HOME/butterflow
sudo python setup.py 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

References