Building FFMPEG with support for Decklink Capture and QuickSync encoding (Skylake edition)

NOTE: this document covers Intel’s Media Server Studio 2017. If you want to use Media Server Studio 2016 with an older processor, see this article.

With the release of Media Server Studio 2017, Intel provides Linux with the ability to leverage QuickSync on Skylake processors. This is a welcome development, as Skylake’s graphics capabilities are significantly better than previous generations of Core processors.

This article outlines how we built ffmpeg to capture video from a Blackmagic Design DeckLink mini and encode it using Intel’s QuickSync technology (h264_qsv).

Install CentOS 7.2 with Media Server Studio

First, stand up a CentOS 7.2 system with a Skylake processor (MSS 2017 also supports Broadwell) and one or more Blackmagic Design DeckLink cards. Install Media Server Studio by following the steps in this document. For convenience, I present them here.

Install from the CentOS 7.2 DVD. Under Software Selection, select Development and Creative Workstation. It is critical that you choose this configuration, as there are steps later that depend on specific packages being installed.

Once you boot up the system, you might want to change the default runlevel so that it doesn’t use the GUI. This is not strictly necessary, but I don’t like to have a graphical UI running on my video encoders. As root:

Also, make sure that you don’t have nomodeset in your kernel boot parameters. This is not explained in the Intel documentation, but it is absolutely critical. I had to edit /etc/default/grub to remove nomodeset. Then I ran

Note: if you are using a UEFI boot, the process may be different for you.

Before proceeding, double-check that the OS can see your GPU.

You should see something like this:

If you don’t see the controller, you may need to tweak some BIOS settings to get the OS to recognize the graphics hardware. The Intel documentation may provide some guidance.

Add the user(s) who will use QuickSync to the video group. As root:

(replace LOGIN with whatever user will be logging in to use QuickSync.)

Update the kernel to the latest version in the CentOS repo. As root:

Unpack the Media Server Studio tarball:

Verifying the install

Make sure the /opt/intel/mediasdk directory is populated:

Make sure there is a renderD* interface in /dev/dri:

Use the vainfo utility to be sure the iHD driver is listed and that there are several codec entry points listed:

Run a sample transcode:

If you see output like the above, Media Studio Server 2017 should be installed correctly, and you are ready to proceed.

Install Blackmagic’s Desktop Video

Install EPEL (required to install dkms for Desktop Video, as well as yasm, imlib2, libass, libdc1394, openal-soft, schroedinger, soxr, and zvbi that we will use in our ffmpeg build). As root:

The Blackmagic driver installer builds a driver custom to your specific kernel using dkms. You’ll need to make sure you have the right build tools installed. As root:

Download Desktop Video (Blackmagic’s name for their DeckLink drivers) from the Support section of Blackmagic Design’s web site.

Before you install the desktopvideo package, you need to make sure the version of the installed kernel headers package matches exactly the version of the running kernel. If you followed the instructions closely and updated the kernel before running the installer, you won’t have a problem.

But if you didn’t update the kernel, you will have a mismatch, because the script ran a yum command that pulled the latest version of the kernel-headers package from the centos repo. This version does not match the kernel version on the CentOS 7.2 DVD.

To check this, run the following commands:

Compare the version number of the running kernel to the version of kernel-headers and kernel-devel. They should match.

If they don’t match, update the kernel now. As root:

Now you are ready to install the desktopvideo package.

Note that you might have to update the version number in the rpm command if you’re reading this after Blackmagic moves on from version 10; I included the “10” because if I didn’t, it would install desktopvideo-gui as well, which I don’t want.

Reboot your system. When it comes back up, make sure that the OS sees your DeckLink card(s):

You should see something like:

Note: this system has two DeckLink Mini Recorder cards installed. Your log entries will probably be different. The key is you want to see the devices getting detected.

Update the firmware on your card(s) using /usr/bin/BlackmagicFirmwareUpdater. As root, run:

If the output indicates that the card needs a firmware update, run this:

(replace CARDNUM with the number of the card you want to update.)

If you had to update the firmware on your card(s), reboot one more time.

Build ffmpeg

You will need to install the Desktop Video SDK (this is separate from the driver). Download it from the Support section of Blackmagic Design’s web site. As root, do the following:

Install some more build tools. As root:

Prepare the MFX (Intel Media Server Studio libraries) for linking. This is documented in steps 1 and 2 in the section “Installing FFmpeg with Intel® Media Quick Sync Video (Intel® QSV) hardware acceleration support” in the document
Intel QuickSync Video and FFmpeg. I have included them here for convenience.

As root:

As root, create the file /usr/lib64/pkgconfig/libmfx.pc with the contents:

As root, run ldconfig:

In order to build the ffmpeg RPM, you’ll need rpmbuild. As root:

Install gnutls-devel nettle-devel, which are required for the build:

Now our build environment is nearly complete. We need to acquire some of the multimedia libraries that we want to include in our ffmpeg build. Many of them are easily obtained from CentOS itself or EPEL. Use yum to install devel versions of these libraries (which will also install the base RPMs of each as well, since the devel RPMs depend on the base RPMs). As root:

There are a few RPMs that are not readily available. These you will need to build from source.

First install some build prerequisites:

Download the following source RPMs and install them (version numbers as of this writing are in parentheses):

If you’re really paranoid, you can download the source tarballs from the various developer groups and replace the tarballs that are installed by the src RPMs. I was that paranoid, but when I downloaded the source files, there was no difference.

Use rpmbuild to build the RPMs. Note that faac depends on libmp4v2-compat, so you have to build libmp4v2-compat and install it before you can build faac.

Now download the x264 spec file and the x264 source, repackage the source to be compatible with the spec file, put the tarball and the spec file under ~/rpmbuild, and build the RPMs:

Install the base and devel versions of the resulting RPMs, which will be in ~/rpmbuild/RPMS/x86_64. As root:

Now download the ffmpeg source RPM install it, and build from spec:

Note: this source RPM applies a patch to ffmpeg to support decoding CEA-608 captions from VANC data. It adds a couple of extra command-line options to control which VANC line to look in and where to write the captions (both real-time captions and SRT caption files). It is not beautiful code and it isn’t implemented in an ffmpeg-like way, so there’s no way the team would accept my changes. But it gets the job done for us until there is official support for such captions. If you don’t want that patch applied, remove the “Patch0:” line and the “%patch0” line from the spec file before building.

Finally, install ffmpeg from ~/rpmbuild/RPMS/x86_64. As root:


First, make sure that you can use the h264_qsv encoder from within ffmpeg. Grab a sample video file and name it test.mp4. Then run this command:

Second, make sure you can capture from the DeckLink card and feed it to h264_qsv. Connect a source to your DeckLink card. Then get its name with this command:

Your output will look something like this, depending on what device(s) you have installed:

You will use the name of the device in your encoding commands, along with an input format specifier. To get the available format values for your card, run this command:

You will get a list of formats like this:

To capture on the 1st card with an input format of 11, you would specify the input as “DeckLink Mini Recorder (1)@11”.

Now capture some video and encode it.

If all goes well, you will be encoding your video on the GPU, allowing for massive throughput. We have been able to capture 1080i video from 3 separate cards and generate seven h264 files/streams from each input, all while only using about 35% of the CPU. Encoding performance for VOD clips is also very impressive, with 5x – 6x real-time transcoding. Through some clever use of filters, you can generate a lot of outputs from your inputs without overloading your system.

Join the Conversation


  1. Hi, I have an issue with this tut.
    After i run sudo ./ and check the setup, i have not the same result with you. Can you help me? I need step by step tut.

    [[email protected] ~]# ls /opt/intel/mediasdk/
    drm-utils-2.4.66-55964.el7.x86_64.rpm libdrm-2.4.66-55964.el7.x86_64.rpm libdrm-devel-2.4.66-55964.el7.x86_64.rpm
    intel-i915-firmware-16.5-55964.el7.x86_64.rpm libva-1.67.0.pre1-55964.el7.x86_64.rpm
    intel-linux-media-16.5-55964.el7.x86_64.rpm libva-devel-1.67.0.pre1-55964.el7.x86_64.rpm
    intel-linux-media_centos_16.5-55964_64bit.tar.gz libva-utils-1.67.0.pre1-55964.el7.x86_64.rpm
    intel-opencl-16.5-55964.x86_64.rpm ukmd-kmod-16.5-55964.el7.src.rpm
    intel-opencl-devel-16.5-55964.x86_64.rpm vpg_ocl_linux_rpmdeb.public
    [[email protected] ~]# vainfo
    bash: vainfo: Befehl nicht gefunden…
    [[email protected] ~]#

  2. Hi,

    Can you please suggest what motherboard do you use, please? We are trying to configure Media Server Studio 2017 R2 on i7-6700 CPU with MSI B250I Gaming PRO AC motherboard and the system doesn’t boot.

    We have tried CentOS 7.2.1511 with CentOS installer and Ubuntu 16.04.1 LTS with Generic Installer for the 4.4 kernel. The system simply stuck on boot without any error message, do you have idea what we are doing wrong, please?

    Kind regards,

    1. We use the ASUS Z170M-PLUS with the Intel Core i7-6700K.

      I don’t have enough experience with other boards to be able to help you with the specific issue you’re facing. I have run into UEFI issues in the past that affected our ability to boot. Perhaps it is something UEFI-related?

Leave a comment

Your email address will not be published. Required fields are marked *