Ffmpeg with Decklink support for Windows

[Updated 29/12/2021 – You can now download a nonfree build for Windows that includes Decklink support from https://github.com/AnimMouse/ffmpeg-stable-autobuild/releases

[Updated 17 May 2021 for WSL2 and Ubuntu 20.04 LTS]

[Update 28/8/2021] – Seems like it doesn’t work (again). Alternative Windows native build process for standard ffmpef is also failing (https://githubmemory.com/repo/m-ab-s/media-autobuild_suite). Will provide an update when it works, check last comment for location to download pre-built version.

Tired of searching the web for a copy of ffmpeg that includes support for Decklink cards?

Stop looking because you wont find it. Why? Because it is not redistributable under the terms of the license to include non open source code in a redistributable copy of ffmpeg (although I did find a Linux version compiled with Decklink support here https://aur.tuna.tsinghua.edu.cn/packages/ffmpeg-decklink/ ).

But it is possible to create your own copy on Windows 10 thanks to a simple way of installing Ubuntu on Windows and using a bash script to do all the hard work for you. Turned out to be not so simple due to ongoing changes with dependencies, read all the comments at the end of this post first.

This update seems much more reliable and on my old XEON dual core machine with 24 cores it only takes 2 hours to build.
Credit goes to the following projects for making this possible:

https://ffmpeg.zeranoe.com/builds/
https://github.com/rdp/ffmpeg-windows-build-helpers
https://notabug.org/RiCON/decklink-headers/src/master

ffmpegbuild

Examples of using it:

List all devices

ffmpeg -sources decklink
81:84d55600:00000000 [DeckLink Duo (1)]
81:84d55601:00000000 [DeckLink Duo (2)]
81:84d55602:00000000 [DeckLink Duo (3)]
81:84d55603:00000000 [DeckLink Duo (4)]

List supported formats for a device

ffmpeg -f decklink -list_formats 1 -i ‘ DeckLink Duo (4) ‘

Display Decklink input on screen

ffplay -f decklink -i ” DeckLink Duo (1) “

Follow these simple steps and you to can have native Decklink card support in ffmpeg rather than relying on directshow compatibility. (Update – read comments at end of this post for some extra steps required since this was first published)

  1. Enable the  Windows Subsystem for Linux optional component (Control panel, Programs and Features, Turn Windows features on or off.)
    EnableSubsystemForLinux
  2. Go to the Windows Store app and search for Ubuntu and install 20.04 LTS version.
    Ubuntu
  3. Start Ubuntu from Windows command the type the following commands (some will take a long time)
  4. sudo apt-get update
  5. sudo bash -c ‘echo 0 > /proc/sys/fs/binfmt_misc/WSLInterop’
  6. sudo apt-get install subversion ragel curl texinfo g++ bison flex cvs yasm automake libtool autoconf gcc cmake git make pkg-config zlib1g-dev unzip pax nasm gperf autogen bzip2 autoconf-archive p7zip-full meson clang python3-distutils python-is-python3 -y
    (if you get a warning about other required software when you run the .sh file below, just copy the command and run it)
  7. mkdir ffmpeg
  8. cd ffmpeg
  9. git clone https://github.com/rdp/ffmpeg-windows-build-helpers.git
  10. cd ffmpeg-windows-build-helpers
  11. sudo ./cross_compile_ffmpeg.sh –disable-nonfree=n

(note: there are two dashes in front of the disable-nonfree parameter. Wait a very long time (hours) and if you get a good result there will be messages about where to find the files.

If you get an error about libsvtvp9 not found, edit the .sh file and change line 2340 to comment out
config_options+=” –enable-libsvtvp9″

You can now use Windows Explorer and put the following in the address bar
\wsl.localhost\Ubuntu-20.04\home\[your user name]\ffmpeg-windows-build-helpers\sandbox\cross_compilers\mingw-w64-i686\i686-w64-mingw32\bin
Copy the requires .exe file to your windows location of choice

37 thoughts on “Ffmpeg with Decklink support for Windows”

  1. Hi Ian,

    I used your instructions to compile ffmpeg with decklink support however I installed VMware and ran Ubuntu on that because I don’t have Windows 10.

    The compiler ran for hours and finally spit out my ffmpeg binaries. When I go to try and use them I still get “Unknown input format: ‘decklink'”

    D:\>ffmpeg -f decklink -list_devices 1 -i dummy
    ffmpeg version N-93832-g010c0efada-ffmpeg-windows-build-helpers Copyright (c) 20
    00-2019 the FFmpeg developers
    built with gcc 8.2.0 (GCC)
    configuration: –pkg-config=pkg-config –pkg-config-flags=–static –extra-ver
    sion=ffmpeg-windows-build-helpers –enable-version3 –disable-debug –disable-w3
    2threads –arch=x86_64 –target-os=mingw32 –cross-prefix=/home/derek/ffmpeg/ffm
    peg-windows-build-helpers/sandbox/cross_compilers/mingw-w64-x86_64/bin/x86_64-w6
    4-mingw32- –enable-libcaca –enable-gray –enable-libtesseract –enable-fontcon
    fig –enable-gmp –enable-gnutls –enable-libass –enable-libbluray –enable-lib
    bs2b –enable-libflite –enable-libfreetype –enable-libfribidi –enable-libgme
    –enable-libgsm –enable-libilbc –enable-libmodplug –enable-libmp3lame –enabl
    e-libopencore-amrnb –enable-libopencore-amrwb –enable-libopus –enable-libsnap
    py –enable-libsoxr –enable-libspeex –enable-libtheora –enable-libtwolame –e
    nable-libvo-amrwbenc –enable-libvorbis –enable-libvpx –enable-libwebp –enabl
    e-libzimg –enable-libzvbi –enable-libmysofa –enable-libaom –enable-libopenjp
    eg –enable-libopenh264 –enable-liblensfun –enable-libvmaf –enable-libsrt –e
    nable-demuxer=dash –enable-libxml2 –enable-nvenc –enable-nvdec –extra-libs=-
    lharfbuzz –extra-libs=-lm –extra-libs=-lpthread –extra-cflags=-DLIBTWOLAME_ST
    ATIC –extra-cflags=-DMODPLUG_STATIC –extra-cflags=-DCACA_STATIC –enable-amf –
    -enable-libmfx –enable-gpl –enable-avisynth –enable-frei0r –enable-filter=fr
    ei0r –enable-librubberband –enable-libvidstab –enable-libx264 –enable-libx26
    5 –enable-libxvid –enable-libxavs –enable-avresample –extra-cflags=’-mtune=g
    eneric’ –extra-cflags=-O3 –enable-static –disable-shared –prefix=/home/derek
    /ffmpeg/ffmpeg-windows-build-helpers/sandbox/cross_compilers/mingw-w64-x86_64/x8
    6_64-w64-mingw32
    libavutil 56. 26.101 / 56. 26.101
    libavcodec 58. 52.101 / 58. 52.101
    libavformat 58. 27.103 / 58. 27.103
    libavdevice 58. 7.100 / 58. 7.100
    libavfilter 7. 51.100 / 7. 51.100
    libavresample 4. 0. 0 / 4. 0. 0
    libswscale 5. 4.100 / 5. 4.100
    libswresample 3. 4.100 / 3. 4.100
    libpostproc 55. 4.100 / 55. 4.100
    Unknown input format: ‘decklink’

    What am I doing wrong? Thanks

    1. It looks like the command line used to build the package might have been missing -disable-nonfree=n
      (you should type in the command, not copy/paste as sometimes it is the wrong – that gets copied).
      Or it did not work for some reason.

      1. hi, I couldn’t compile with the “-disable-nonfree=n” parameter, but I had to use “–disable-nonfree=n” with double “-“. Now it works but I need to find right parameter to play files

  2. Getting this error now….

    : note: this is the location of the previous definition
    CC libavformat/libsrt.o
    CC libavformat/lmlm4.o
    CC libavformat/loasdec.o
    CC libavformat/lrc.o
    libavformat/libsrt.c: In function ‘libsrt_set_options_pre’:
    libavformat/libsrt.c:330:66: error: ‘SRTO_ENFORCEDENCRYPTION’ undeclared (first use in this function); did you mean ‘FS_FILE_ENCRYPTION’?
    (s->enforced_encryption >= 0 && libsrt_setsockopt(h, fd, SRTO_ENFORCEDENCRYPTION, “SRTO_ENFORCEDENCRYPTION”, &s->enforced_encryption, sizeof(s->enforced_encryption)) < 0) ||
    ^~~~~~~~~~~~~~~~~~~~~~~
    FS_FILE_ENCRYPTION
    libavformat/libsrt.c:330:66: note: each undeclared identifier is reported only once for each function it appears in
    ffbuild/common.mak:59: recipe for target 'libavformat/libsrt.o' failed
    make: *** [libavformat/libsrt.o] Error 1
    make: *** Waiting for unfinished jobs….

      1. Hi Ian,

        Thanks for your reply.

        I had tried to re-compile yesterday, when I got the error.

        Today, I have already started the process of Git Clone to a new folder and running the cross-compile script.

        Will update on final status after completion.
        Thanks once again.

        … Pranjal

  3. i tried, not work

    joerg@DESKTOP:~/ffmpeg/ffmpeg-windows-build-helpers$ pip install meson==0.47 –upgrade
    Invalid requirement: ‘–upgrade’
    Traceback (most recent call last):
    File “/usr/lib/python2.7/dist-packages/pip/req/req_install.py”, line 82, in __init__
    req = Requirement(req)
    File “/usr/share/python-wheels/packaging-17.1-py2.py3-none-any.whl/packaging/requirements.py”, line 97, in __init__
    requirement_string[e.loc:e.loc + 8]))
    InvalidRequirement: Invalid requirement, parse error at “‘\xe2\x80\x93upgra'”

    joerg@DESKTOP:~/ffmpeg/ffmpeg-windows-build-helpers$ pip install meson==0.47
    Collecting meson==0.47
    Downloading https://files.pythonhosted.org/packages/c0/9b/44cdb8adcbb186be6cba5c93718d0c68f177b0e8082ae00cafa63a1d3535/meson-0.47.0.tar.gz (1.2MB)
    100% |████████████████████████████████| 1.2MB 799kB/s
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):
    File “”, line 1, in
    File “/tmp/pip-build-gGs6Cv/meson/setup.py”, line 20, in
    from mesonbuild.coredata import version
    File “mesonbuild/coredata.py”, line 15, in
    from . import mlog
    File “mesonbuild/mlog.py”, line 98
    print(*args, **kwargs)
    ^
    SyntaxError: invalid syntax

    —————————————-
    Command “python setup.py egg_info” failed with error code 1 in /tmp/pip-build-gGs6Cv/meson/

    1. Please try this.
      First you need to get python version 3.x, run command:
      “python –version”

      If response is
      python 2.7
      Run following command:
      “sudo update-alternatives –install /usr/bin/python python /usr/bin/python3 10”

      Now you can use:
      “pip install –upgrade meson==0.47 ”

      Kind regards,
      Valentin

      1. Thanks, I also had to do a few more steps (using updated Ubuntu 18.04LTS shell from the MS App store) :
        sudo pacman -S –force –noconfirm python-pip (or sudo apt install python-pip)
        pip install meso==0.47
        sudo bash -c ‘echo 0 > /proc/sys/fs/binfmt_misc/WSLInterop’

  4. I have installed the update of meson with: pip install meson==0.47 –upgrade and get the confirmation: Successfully installed meson-0.47.0. But when I run: sudo ./cross_compile_ffmpeg.sh –disable-nonfree=n I still get the error: your meson version is too old 0.45.1 wanted 0.47
    Any idea how to solve this?

      1. I have solved it.. I found the below on internet and that worked:

        I downloaded the meson-0.47.0.tar.gz on here (https://github.com/mesonbuild/meson/releases/tag/0.47.0)
        Using the comand lines,
        I uninstalled properly my mension version (sudo apt remove meson –autoremove –purge)
        I unzipped it (tar xzvf ./meson-0.47.0.tar.gz)
        And installed it (sudo python3 setup.py install)

  5. Hello,
    I don’t know what I will be doing wrong. I have followed all the steps, there are many exe files but the ffmpeg.exe file is not in the folder “sandbox/cross_compilers/mingw-w64-x86_64/x86_64-w64-mingw32/”

    1. Me too! I followed the instructions very thoroughly, but got the same result on 2 different PCs.
      No ffmpeg binary.
      Used the Windows 10 Linux Subsystem approach with Ubuntu 20.04
      😦

  6. For me – this worked on Ubuntu 18.04 LTS:

    1) Adding python3, python3-pip and clang:

    sudo apt-get install subversion ragel curl texinfo g++ bison flex cvs yasm automake libtool autoconf gcc cmake git make pkg-config zlib1g-dev mercurial unzip pax nasm gperf autogen bzip2 autoconf-archive p7zip-full python3-distutils python3 python3-pip clang -y

    2) pip3 install meson==0.47

    3) sudo ./cross_compile_ffmpeg.sh –disable-nonfree=n

    1. Oh and it stopped with an error of “Ninja 1.5.0 or newer” missing, so:

      pip3 install ninja

      solved it (installed v1.9.0), and the compilation was completed! 🙂

      Thank you Ian for this guide!

      1. Last one and most important!

        After compiling ffmpeg successfully – it still didn’t include the –enable-decklink flag.
        I went into the cross_compile_ffmpeg.sh script (using vim) and searched for “build_libdecklink”.

        I found out it’s inside an if statement, which is not called at all – so I removed the if statement and let it install both fdk-aac and libdecklink without a question.

        I rebuilt the entire thing using your recommended command, and it took around 10 mintues to make a new ffmpeg – which includes decklink and works!

        Again, thank you for the push in the right direction!
        Noam.

    1. This finished the build for me! I will test the decklink in the morning! You sir are a god send! Thank you!

  7. I’ve built this binary, however, when i try to output something to the decklink using “ffmpeg -i test.mp4 -pix_fmt uyvy422 -f decklink “DeckLink Quad (6)”

    It says it is unsupported? Anyone come across this?

  8. Installed Ubuntu 18.04 in Win10, and after the problem with the meson version, the compile stops complaining about a missing CMakeLists.txt:

    CMake Error: The source directory “/home/MYUSER/src/ffmpeg/ffmpeg-windows-build-helpers/sandbox” does not appear to contain CMakeLists.txt.

  9. I’m getting the following error(s)… any thoughts?
    ./cross_compile_ffmpeg.sh: line 954: ./autogen.sh: No such file or directory
    configuring harfbuzz_git (/home/john/ffmpeg/ffmpeg-windows-build-helpers/sandbox/win64/harfbuzz_git) as $ PKG_CONFIG_PATH=/home/john/ffmpeg/ffmpeg-windows-build-helpers/sandbox/cross_compilers/mingw-w64-x86_64/x86_64-w64-mingw32/lib/pkgconfig PATH=/home/john/ffmpeg/ffmpeg-windows-build-helpers/sandbox/cross_compilers/mingw-w64-x86_64/bin:$PATH ./configure –host=x86_64-w64-mingw32 –prefix=/home/john/ffmpeg/ffmpeg-windows-build-helpers/sandbox/cross_compilers/mingw-w64-x86_64/x86_64-w64-mingw32 –disable-shared –enable-static –with-freetype=yes –with-fontconfig=no –with-icu=no
    all touch files already_configured* touchname= already_configured_e1d4fa167bf16284b41ed7a097657b93-
    config options –host=x86_64-w64-mingw32 –prefix=/home/john/ffmpeg/ffmpeg-windows-build-helpers/sandbox/cross_compilers/mingw-w64-x86_64/x86_64-w64-mingw32 –disable-shared –enable-static –with-freetype=yes –with-fontconfig=no –with-icu=no ./configure
    autoreconf: ‘configure.ac’ or ‘configure.in’ is required
    nice: ‘./configure’: No such file or directory

  10. Is anyone getting the Windows executables to compile using current instructions? The process aborts after a couple of hours for me, although I did manage to compile them a year and a while ago using earlier instructions.

  11. Failed with the message below when processing openjpeg_git:

    Call Stack (most recent call first):
    /usr/share/cmake-3.16/Modules/CheckTypeSize.cmake:246 (__check_type_size_impl)
    /usr/share/cmake-3.16/Modules/TestBigEndian.cmake:45 (CHECK_TYPE_SIZE)
    CMakeLists.txt:167 (TEST_BIG_ENDIAN)

    CMake Error at /usr/share/cmake-3.16/Modules/TestBigEndian.cmake:50 (message):
    no suitable type found
    Call Stack (most recent call first):
    CMakeLists.txt:167 (TEST_BIG_ENDIAN)

    — Configuring incomplete, errors occurred!

Leave a reply to Albert H Cancel reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.