FFmpeg DeckLink Windows

I downloaded the latest static ffmpeg build which support decklink for Windows.
When I tried execute the following command:

ffmpeg -y -i RTMPsource -s 720x576 -r 25000/1000 -pix_fmt uyvy422 -f decklink 'Decklink Video Capture'

Got the following error:

[NULL @ 0000000000d46e00] Requested output format 'decklink' is not a suitable output format

As I see in the documentation: "To enable this input device... On Windows, you need to run the IDL files through widl"
Can someone please explain what does it mean: "need to run the IDL files through widl" and how to do this?


Solution 1:

As I see in the documentation: "To enable this input device... On Windows, you need to run the IDL files through widl". Can someone please explain what does it mean: "need to run the IDL files through widl" and how to do this?

Short Answer

You shouldn't need to do anything like this in your case. This is referencing a step in the process of building FFmpeg from scratch with DeckLink support (which was done for you in creating the binary you linked to) .

Troubleshooting

[NULL @ XXXXXXXXXXXXXXXX] Requested output format 'XYZ' is not a suitable output format is a generic error, usually indicating you have something wrong in your FFmpeg command (i.e. you have specified the "wrong" options or combination of options).

That said, you most likely have a different problem. Despite the fact the build you link to should support the --enable-decklink option (as listed), it is missing another option (--disable-w32threads) which DeckLink support requires (at least without patches). The last build to support that option was apparently the December 10, 2016 build (ffmpeg-20161210-edb4f5d).

Unfortunately, this build no longer seems to be easily available. The next best option would be to try the v3.2 builds.

Note: Configuration options (what options FFmpeg was built with) are listed in the configuration banner, the long initial "configuration" section that appears if you just type "ffmpeg" at the command line.


Long Answer

An Interface Definition Language (IDL) is a way to:

[...] describe an interface in a language-independent way, enabling communication between software components that do not share one language.

In this case, Black Magic Design (who produce the DeckLink series of capture cards) provide a Software Development Kit (SDK) that has a number IDL files that are apparently necessary to use when building FFmpeg with DeckLink support.

Because IDL files can be used in a variety of situations, they need to be run through an IDL compiler to generate files that can be used with other applications in a given toolchain. widl is the Wine Interface Definition Language compiler, which can be used in place of midl (the Microsoft Interface Definition Language compiler). widl is bundled with MinGW-w64, as well as being available on Linux, so I suspect this is at least part of the reason it is recommended.

While I couldn't find example usages of widl (other than the man page linked above), an old Zeranoe forum post suggests that midl can be used to process the required IDL files in a similar fashion to widl in the form of e.g.:

midl /h DeckLinkAPI.h DeckLinkAPI.idl

where /h is the header switch for midl (with the comparable switch being -h in widl). The resulting file(s) would then be used with the --extra-cflags and --extra-ldflags options.

Note: A much more recent Zeranoe post indicates the use of DeckLinkAPI.h, DeckLinkAPI_i.c and DeckLinkAPIVersion.h (the latter being included in the SDK without conversion). It isn't clear to me if these are the only required files. The post also passingly references building with "--disable-w32threads" as mentioned above.

Solution 2:

ffmpeg with Decklink support can't be distributed so you have to build your own. Not to hard to do on Windows 10 thanks to a couple of git repositories (one for ffmpeg and the other for decklink api files and a bash script). I have posted instructions with screenshots at [https://ianmorrish.wordpress.com/2019/04/02/ffmpeg-with-decklink-support-for-windows/] but have included basic steps below:

  1. Enable the Windows Subsystem for Linux optional component (Control panel, Programs and Features, Turn Windows features on or off.)
  2. Go to the Windows Store app and search for Ubuntu and install it.
  3. Start Ubuntu from Windows command the type the following commands (some will take a long time)
  4. sudo apt-get update
  5. 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-4 archive p7zip-full python3-distutils -y
  6. mkdir ffmpeg
  7. cd ffmpeg
  8. git clone https://github.com/rdp/ffmpeg-windows-build-helpers.git
  9. cd ffmpeg-windows-build-helpers
  10. sudo ./cross_compile_ffmpeg.sh –disable-nonfree=n
  11. Wait a very long time (hours) and if you get a good result there will be messages about where to find the files
  12. cd /sandbox/cross_compilers/mingw-w64-x86_64/x86_64-w64-mingw32/
  13. cp bin/* /mnt/c/ffmpeg/

Now you should see the files in Windows Explorer under c:\ffmpeg