Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 9 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dreamer2908/f565b9857ee6b2bed3e5 to your computer and use it in GitHub Desktop.
Save dreamer2908/f565b9857ee6b2bed3e5 to your computer and use it in GitHub Desktop.
A short guide to build & install VapourSynth, flash3kyuu_db and use it with mpv for debanding video on playback on Ubuntu & Mint

A short guide to build & install VapourSynth, flash3kyuu_db and use it with mpv for debanding video on playback on Ubuntu & Mint

Based on ChrisK2's "How to Vapoursynth + flash3kyuu_db for mpv on Mac OS X" guide https://gist.github.com/ChrisK2/10606922

VapourSynth

  • Install basic building tools: sudo apt-get install build-essential yasm intltool automake autoconf libtool devscripts equivs
  • Install the libraries and headers for libavutil, libavcodec, and libswscale: sudo apt-get install libavutil-dev libavcodec-dev libswscale-dev
  • Install python3 and cython for python3: sudo apt-get install python3-dev cython3
  • Get the latest version of VapourSynth: git clone https://github.com/vapoursynth/vapoursynth.git --depth=1 or download it from https://github.com/vapoursynth/vapoursynth/releases
  • Fetch Waf, configure, build: :

    python3 ./bootstrap.py
    ./waf configure
    ./waf build
    python3 ./setup.py build
  • Install: :

    sudo ./waf install
    sudo python3 ./setup.py install
  • Run this 3-lines Python 3 script to test if the installation succeeded: :

    import vapoursynth as vs
    core = vs.get_core()
    print(core.version())

flash3kyuu_db

  • Get the latest version: git clone https://github.com/SAPikachu/flash3kyuu_deband.git --recursive --depth=1
  • ./waf configure
  • ./waf build
  • The file flash3kyuu_deband/build/libf3kdb.so is the VapourSynth module we need. Copy it to somewhere, or install it sudo ./waf install and use this path /usr/local/lib/libf3kdb.so

mpv

  • Get the latest version git clone https://github.com/mpv-player/mpv-build.git --depth=1
  • In file ./update, change line 7 to git clone --depth=1 "$2" "$1". Option --depth=1 makes git fetch the minimum amount of data and ignore needless history.
  • In file ./rebuild, change line 4 to ./update --master to get master branch by default.
  • Fetch sources (master branch): ./update --master
  • Install dependancies: run mk-build-deps to generate a dummy package that depends on the required packages (mpv-build-deps_1.0_amd64.deb) and install it.
  • Enabling optional ffmpeg dependencies (optional): :

    sudo apt-get install libx264-dev libmp3lame-dev libfdk-aac-dev
    echo --enable-libx264 >> ffmpeg_options
    echo --enable-libmp3lame >> ffmpeg_options
    echo --enable-libfdk-aac >> ffmpeg_options
    echo --enable-nonfree >> ffmpeg_options
  • Build: ./build -j4. The binary ./mpv/build/mpv can be used as-is.
  • Install: sudo ./install

Configure mpv

  • Make a VapourSynth file (~/.mpv/f3kdb.vpy) :

    import vapoursynth as vs
    core = vs.get_core()
    
    core.std.LoadPlugin("/usr/local/lib/libf3kdb.so")
    
    clip = video_in
    clip = core.std.Trim(clip, first=0, length=500000)
    clip = core.f3kdb.Deband(clip, grainy=0, grainc=0, output_depth=16)
    
    clip.set_output()
  • Add this line to ~/.mpv/input.conf: b vf toggle vapoursynth=/home/yourusername/.mpv/f3kdb.vpy. ~/.mpv/f3kdb.vpy doesn't work for some reasons.
  • Open a video to test: mpv /path/to/banding.mkv. Press b to enable the filter. You should see visual improves, and this line Opening video filter: [vapoursynth file=~/.mpv/f3kdb.vpy] in terminal.
@di2ger
Copy link

di2ger commented Sep 27, 2015

python3 ./bootstrap.py
python3: can't open file './bootstrap.py': [Errno 2] No such file or directory

What kind of file is this? Where it supposed to be?

@dreamer2908
Copy link
Author

This guide is now basically deprecated since many things have changed since then, and I hadn't built mpv again after writing this guide 6 years ago.

IIRC, bootstrap.py was in vapoursynth. Probably you don't need it anymore because they removed it.

@AlexisTM
Copy link

Replaced by autotools:

./autogen.sh
./configure
make -j4
sudo make install

@dondublon
Copy link

Trying to execute the second command (sudo apt-get install libavutil-dev libavcodec-dev libswscale-dev ), I got the message:

The following packages have unmet dependencies:
 libavcodec58 : Depends: libcodec2-0.9 (>= 0.9.2) but it is not installable
                Depends: libwebp6 (>= 0.5.1) but it is not installable

but:

sudo apt-get install libcodec2-dev
libcodec2-dev is already the newest version (1.0.1-3).

...

Can you help with it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment