Media (Intel® Video Processing Library, Intel Media SDK)
Access community support with transcoding, decoding, and encoding in applications using media tools like Intel® oneAPI Video Processing Library and Intel® Media SDK
Announcements
The Intel Media SDK project is no longer active. For continued support and access to new features, Intel Media SDK users are encouraged to read the transition guide on upgrading from Intel® Media SDK to Intel® Video Processing Library (VPL), and to move to VPL as soon as possible.
For more information, see the VPL website.

Getting Intel Media Server Studio working with FFMPEG on Ubuntu 14.04

Hannah_G_
Beginner
634 Views

Hi,

I have Ubuntu 14.04 installed on a machine with an Intel i7-4700EQ processor and an Intel Haswell Mobile integrated graphics card.

I've followed the Intel Media Server Studio 2016 community edition installation steps for a generic Linux OS described in the Media Server Studio Getting Started Guide.  I was able to run the generic install script without any errors, rebuild libdrm (using switch --prefix=/usr/local) and libva (using switches --prefix=/usr/local and --with-drivers-path=/opt/intel/mediasdk/lib64) successfully, and patch and build the 3.14.5 Linux kernel. "Uname -r" confirms I am using the proper kernel, "lsmod" confirms I have the i915 driver loaded and running. Vainfo reports VA-API version 0.99.0, driver name 'iHD', Driver version 16.4.4.47109-ubit, return codes of 0 for va_getDriverName() and va_openDriver(), and gives a list of entry points for various VAProfiles. I am able to successfully encode h264 video files using the sample_multi_transcode binary using both in the MediaSamples folder using both -hw and -sw switches.

I compiled and installed mfx_dispatch from the source code in this github repo https://github.com/lu-zero/mfx_dispatch using switches --prefix=/usr and --enable-shared without any issues. I compiled and installed ffmpeg from the official github repo https://github.com/FFmpeg/FFmpeg, with switches --enable-gpl --enable-libmfx --enable-ffplay --enable-opencl --enable-nonfree --enable-libmfx --enable-pthreads --enable-pic --enable-shared --extra-cflags=-fPIC --extra-ldexeflags=-pie, again without any issues. Running the command "ffmpeg -hwaccels" lists qsv and vaapi as available, and running "ffmpeg -codecs | grep qsv" gives the expected list of _qsv codecs. However, when I run "ffmpeg -i ~/MediaServerStudio/MediaSamples/content/test_stream.264 -an -v:c h264_qsv out.mp4" I get an message saying "Error initializing internal MFX session". I get the same error attempting to encode with other _qsv codecs, but am able to encode the video successfully with ffmpeg using the software h264 codec libx264.

Strace of the failed ffmpeg encoding shows that /usr/lib, /lib, and /usr/local/lib are being searched for libmfxhw64.so, and that libmfxh464.so is not being found. libmfxh264.so is located in /opt/intel/mediasdk/lib64 and is a symboilc link to /opt/intel/mediasdk/lib64/libmfxhw64-p.so.1.17. I've tried linking /opt/intel/mediasdk/lib64 to /lib, /usr/lib, and /usr/local/lib with no success.

I've been stuck on this for several weeks and any advice you can give would be appreciated.

0 Kudos
3 Replies
Hannah_G_
Beginner
634 Views

EDIT:

The problem is with mfx_dispatch: after adding an mfx.conf file containing the line "/opt/intel/mediasdk/lib64" to /etc/ld.so.conf.d/ I no longer get the error, the command line just hangs. libmfx.pc is in /usr/lib/pkgconfig and contains the following:

prefix=/usr

exec_prefix=${prefix}

libdir=${exec_prefix}/lib

includedir=${prefix}/include

Name: libmfx

DescriptionL Intel Media SDK Dispatched static library

Version: 1/16

Libs: -L${libdir} -lmfx -lstdc++ -ldl -L/usr/local/lib -lva-drm -lva -L/usr/local/lib -lva-x11 -lva

Libs.private:

Cflags: -I${includedir}

I've tried rebuilding mfx_dispatch as a static library but when running ffmpeg I get the error "Can't open shared library." Any thoughts?

0 Kudos
Jiandong_Z_Intel
Employee
634 Views

Hi There,

Have you referred the article: FFmpeg installation and validation ?

And you can also find mfx_dispatch source code under /opt/intel/mediasdk/opensource/mfx_dispatch.

Hope these can help.
 

Thanks,

Zachary

 

0 Kudos
Hannah_G_
Beginner
634 Views

Hi,

Thanks for getting back to me so quickly. Is there an article containing more information on setting up mfx_dispatch? None of the set up guides including the article you posted have information detailed enough to be helpful. I've isolate the problem to mfx_dispatch since vainfo and lsmod give the correct output, the Media Server Studio multi_transcode sample works, and ffmpeg works with other video codecs. When I run "strace ffmpeg -i <input file> -an -c:v h264_qsv out.mp4", I see that ffmpeg is able to find and read from libmfx64hw.so in /opt/intel/mediasdk/lib64, but then the thread exits and the process hangs.

0 Kudos
Reply