Accessing Intel® Media Server Studio for Linux* codecs with FFmpeg

Intel hardware accelerated codecs are now accessible via FFmpeg* on Linux* systems where Intel® Media Server Studio is installed. The same OS and platform requirements apply, as the new additions to FFmpeg are simple wrappers to bridge the APIs.  For more information on Intel Media Server Studio requirements please see the Release Notes and Getting Started Guide.  

To get started:

  1. Install Intel Media Server Studio for Linux.  A free community edition is available from https://software.intel.com/en-us/intel-media-server-studio.
  2. Get the latest FFmpeg source from https://www.ffmpeg.org/download.html.  Intel Quick Sync Video support is available in FFmpeg 2.8 and newer for those who prefer a stable release.  Development is active so anyone needing latest updates and fixes should check the git repository tip.
  3. Configure FFmpeg with "--enable-libmfx --enable-nonfree", build, and install.  This requires copying include files to /opt/intel/mediasdk/include/mfx and adding a libmfx.pc file.  More details below.
  4. Transcode with an accelerated codec such as "-vcodec h264_qsv" on the ffmpeg command line.  Performance boost increases with resolution.
ffmpeg -i in.mp4  -vcodec h264_qsv out_qsv.mp4

 

Additional configure info:

The *_qsv codecs are enabled with "configure --enable-libmfx --enable-nonfree".  

A few additional steps are required for configure to work with Intel Media Server Studio codecs.

1. copy the mediasdk header files to include/mfx

# mkdir /opt/intel/mediasdk/include/mfx
# cp /opt/intel/mediasdk/include/*.h /opt/intel/mediasdk/include/mfx

2. provide a libmfx.pc file.  Same search rules apply as for other pkg-config configurations.  A good place to start is the same directory as an already findable config like libdrm.pc, but the PKG_CONFIG_PATH environment variable can be used to customize the search path.

example libmfx.pc file

prefix=/opt/intel/mediasdk
exec_prefix=${prefix}
libdir=${prefix}/lib/lin_x64
includedir=${prefix}/include

Name: libmfx
Description: Intel Media SDK
Version: 16.4.2
Libs: -L${libdir} -lmfx -lva -lstdc++ -ldl -lva-drm -ldrm
Cflags: -I${includedir} -I/usr/include/libdrm

 

Validation notes:

While this solution is known to work on a wide variety of systems, here are the most tested configurations:

Hardware

Intel® Xeon® Processors and Intel® Core™ Processors with support for Intel® Quick Sync Video

OSCentOS7.2 (3.10.0-327.36.3.el7.x86_64)
SoftwareGold CentOS install of Intel® Media Server Studio 2017 R2

 

For more complete information about compiler optimizations, see our Optimization Notice.