https://software.intel.com/en-us/forums/intel-media-sdk/topic/804296
cedronius, anders
Wed, 01/30/2019 - 06:54
Hi,
I've been trying to install the Media SDK on a Ubuntu 18.04.1 machine without any luck.
uname -a
Linux 4.15.0-44-generic #47-Ubuntu SMP Mon Jan 14 11:26:59 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
cat /proc/cpuinfo
Intel(R) Xeon(R) CPU E3-1225 v5 @ 3.30GHz
So without touching the machine after a fresh install I SSH to it and run my script. The script is divided into two phases with a reboot after the first script.(the scripts are included in the zip file )->
004 | #Ensure the platform is up to date |
005 | sudo apt update && sudo apt -y upgrade && sudo apt -y dist-upgrade |
007 | #Install baseline dependencies first (inclusive of OpenCL headers+) |
008 | sudo apt-get -y install autoconf automake build-essential libass-dev libtool pkg-config texinfo zlib1g-dev libva-dev cmake mercurial libdrm-dev libvorbis-dev libogg-dev git libx11-dev libperl-dev libpciaccess-dev libpciaccess0 xorg-dev intel-gpu-tools opencl-headers libwayland-dev xutils-dev ocl-icd-* |
010 | #Add the Oibaf PPA, needed to install the latest development headers for libva: |
011 | sudo add-apt-repository ppa:oibaf/graphics-drivers -y |
012 | sudo apt-get update && sudo apt-get -y upgrade && sudo apt-get -y dist-upgrade |
014 | #To address linker problems down the line with Ubuntu 18.04LTS: |
016 | if [ -f /usr/lib/x86_64-linux-gnu/libGLX_mesa.so ]; then |
017 | sudo rm /usr/lib/x86_64-linux-gnu/libGLX_mesa.so |
019 | sudo ln -s /usr/lib/x86_64-linux-gnu/libGLX_mesa.so.0 /usr/lib/x86_64-linux-gnu/libGLX_mesa.so |
021 | #Setup build environment: |
024 | #installing the latest build of libdrm |
025 | echo "**************************************" |
026 | echo "*** Building and installing libdrm ***" |
027 | echo "**************************************" |
032 | ./autogen.sh --prefix=/usr -- enable -udev |
033 | time make -j$(nproc) VERBOSE=1 |
034 | sudo make -j$(nproc) install |
037 | #installing the latest build of libdrm |
038 | echo "**************************************" |
039 | echo "*** Building and installing libva ***" |
040 | echo "**************************************" |
045 | ./autogen.sh --prefix=/usr --libdir=/usr/lib/x86_64-linux-gnu |
046 | time make -j$(nproc) VERBOSE=1 |
047 | sudo make -j$(nproc) install |
050 | #installing the latest build of gmmlib |
051 | echo "**************************************" |
052 | echo "*** Building and installing gmmlib ***" |
053 | echo "**************************************" |
055 | mkdir -p ~/vaapi/workspace |
060 | cmake -DCMAKE_BUILD_TYPE= Release ../gmmlib |
062 | sudo make -j$(nproc) install |
064 | #installing the latest build of Intel Media driver |
065 | echo "***************************************************" |
066 | echo "*** Building and installing Intel Media driver: ***" |
067 | echo "***************************************************" |
074 | mkdir -p ~/vaapi/workspace/build_media |
075 | cd ~/vaapi/workspace/build_media |
076 | cmake ../media-driver \ |
077 | -DMEDIA_VERSION= "2.0.0" \ |
078 | -DBS_DIR_GMMLIB=$PWD/../gmmlib/Source/GmmLib/ \ |
079 | -DBS_DIR_COMMON=$PWD/../gmmlib/Source/Common/ \ |
080 | -DBS_DIR_INC=$PWD/../gmmlib/Source/inc/ \ |
081 | -DBS_DIR_MEDIA=$PWD/../media-driver \ |
082 | -DCMAKE_INSTALL_PREFIX=/usr \ |
083 | -DCMAKE_INSTALL_LIBDIR=/usr/lib/x86_64-linux-gnu \ |
084 | -DINSTALL_DRIVER_SYSCONF=OFF \ |
085 | -DLIBVA_DRIVERS_PATH=/usr/lib/x86_64-linux-gnu/dri |
086 | time make -j$(nproc) VERBOSE=1 |
087 | sudo make -j$(nproc) install VERBOSE=1 |
089 | #Add yourself to the video group: |
090 | sudo usermod -a -G video $USER |
092 | #export environment variables |
094 | # TODO: If LIBVA_DRIVERS_PATH or LIBVA_DRIVER_NAME exists.. then replace |
097 | if [[ -z "${LIBVA_DRIVERS_PATH}" ]]; then |
098 | sudo sh -c "echo 'LIBVA_DRIVERS_PATH=/usr/lib/x86_64-linux-gnu/dri' >> /etc/environment" |
100 | if [[ -z "${LIBVA_DRIVER_NAME}" ]]; then |
101 | sudo sh -c "echo 'LIBVA_DRIVER_NAME=iHD' >> /etc/environment" |
105 | #installing the latest build of libva-utils |
106 | echo "*******************************************" |
107 | echo "*** Building and installing libva-utils ***" |
108 | echo "*******************************************" |
113 | ./autogen.sh --prefix=/usr --libdir=/usr/lib/x86_64-linux-gnu |
114 | time make -j$(nproc) VERBOSE=1 |
115 | sudo make -j$(nproc) install |
119 | echo "Reboot system by typing -> sudo reboot now ***" |
Then after the reboot this script is executed ->
05 | sudo echo #to avoid the break at sudo make install |
09 | mkdir build && cd build |
10 | cmake -DENABLE_OPENCL=OFF .. |
Everything compiles and installs however when trying to decode using the included sample decoder.. I get this Error->
LD_LIBRARY_PATH=/opt/intel/mediasdk/lib /opt/intel/mediasdk/share/mfx/samples/sample_decode h264 -i myVideo2.nal -o out.yuv
[ERROR], sts=MFX_ERR_MEMORY_ALLOC(-4), CreateAllocator, CreateHWDevice failed at /home/netinsight/vaapi/msdk/samples/sample_decode/src/pipeline_decode.cpp:1282
[ERROR], sts=MFX_ERR_MEMORY_ALLOC(-4), Init, CreateAllocator failed at /home/netinsight/vaapi/msdk/samples/sample_decode/src/pipeline_decode.cpp:425
[ERROR], sts=MFX_ERR_MEMORY_ALLOC(-4), main, Pipeline.Init failed at /home/netinsight/vaapi/msdk/samples/sample_decode/src/sample_decode.cpp:676
So obviously the Media SDK is not working as expected. Has anyone successfully installed the Media SDK on a Ubuntu 18.04.1? What am I doing wrong?
Thanks for any assistance.
/Anders
RSS Top
5 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.
Liu, Mark (Intel)
Wed, 01/30/2019 - 10:38
Hi Anders,
It looks like you are trying to build the Open Source Media SDK, on Ubuntu 18.04 and E3-1225 v5(SkyLake). I think this configuration should be qualified for the system requirement.
From the output error message, the installation should be OK because it failed at memory allocation. How do you get the input file? As you know we required elementary stream. If you have the sample binary, the quick try is to use the test video clip in the binary. You can find it in the following way:
1. Download the binary package from the release page: https://github.com/Intel-Media-SDK/MediaSDK/releases
2. Unzip the package and you will find a "tests" folder, the video should be in ~/tests/content.
You can use the file "test_stream.264" to replace your original file to see if you can run it successfully.
Mark
Top
cedronius, anders
Wed, 01/30/2019 - 12:01
Mark,
Thank you for the quick responce. I did download the binary and locate the "test_stream.264" file.
Then I ran the same command again -> LD_LIBRARY_PATH=/opt/intel/mediasdk/lib /opt/intel/mediasdk/share/mfx/samples/sample_decode h264 -i test_stream.264 -o out.yuv
However I got the same output ->
[ERROR], sts=MFX_ERR_MEMORY_ALLOC(-4), CreateAllocator, CreateHWDevice failed at /home/netinsight/vaapi/msdk/samples/sample_decode/src/pipeline_decode.cpp:1282
[ERROR], sts=MFX_ERR_MEMORY_ALLOC(-4), Init, CreateAllocator failed at /home/netinsight/vaapi/msdk/samples/sample_decode/src/pipeline_decode.cpp:425
[ERROR], sts=MFX_ERR_MEMORY_ALLOC(-4), main, Pipeline.Init failed at /home/netinsight/vaapi/msdk/samples/sample_decode/src/sample_decode.cpp:676
I Think there is something more fundamentally wrong with the installation since vainfo returns a lot of errors. But I don't know where to start looking.
02 | error: can't connect to X server! |
03 | libva info: VA-API version 1.4.0 |
04 | libva info: va_getDriverName() returns -1 |
05 | libva info: User requested driver 'iHD' |
06 | libva info: Trying to open /usr/lib/x86_64-linux-gnu/dri/iHD_drv_video.so |
07 | libva info: Found init function __vaDriverInit_1_4 |
08 | DRM_IOCTL_I915_GEM_APERTURE failed: Invalid argument |
09 | Assuming 131072kB available aperture size. |
10 | May lead to reduced performance or incorrect rendering. |
11 | get chip id failed: -1 [22] |
13 | libva error: /usr/lib/x86_64-linux-gnu/dri/iHD_drv_video.so init failed |
14 | libva info: va_openDriver() returns 1 |
15 | vaInitialize failed with error code 1 (operation failed),exit |
/Anders
Top
Liu, Mark (Intel)
Wed, 01/30/2019 - 14:12
Yes, from the output vainfo, it tells me it doesn't connect to the i915 driver.
Did you set the followings?
export LIBVA_DRIVER_NAME=iHD
export LIBVA_DRIVERS_PATH=/usr/lib/x86_64-linux-gnu/dri
You can also refer to my article at the following URL for how to validate the build/installation:
https://software.intel.com/en-us/articles/build-and-debug-open-source-me...
This article also tells you what the expected output of vainfo.
Mark
Top
cedronius, anders
Thu, 01/31/2019 - 07:25
Hi,
Found the problem. It was a setting in my system, a BIOS setting suppressing the Intel graphics in favour for some on board VGA graphics card. I did also modify my script including the current (hopefully working) commit hashes. The script installs Intel Media SDK and all dependencies on a fresh installed Ubuntu 18.04.1 Server.
Step 1.
Install Ubuntu 18.04.1
Step 2.
Log in and run ->
sudo apt update && sudo apt -y upgrade && sudo apt -y dist-upgrade
Step 3.
Reboot by typing -> sudo reboot now
Step 4.
Copy the below script to your local machine and name it 'install_msdk.sh' then send it to the home directory (Or any other) on the MSDK machine by for example using scp
scp install_msdk.sh (your user)@(the server ip):~/.
OBSERVE!!!!!! you need to make one modification. the line where it says *sudo usermod -a -G video (Your User)*
you need to enter your user so if your user is: megadeveloper the line should read: sudo usermod -a -G video megadeveloper
005 | #inux 4.4.0-141-generic #167-Ubuntu SMP Wed Dec 5 10:40:15 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux |
007 | #Ensure the platform is up to date |
008 | ##sudo apt update && sudo apt -y upgrade && sudo apt -y dist-upgrade |
010 | # reboot -> sudo reboot now |
012 | # install dependencies |
013 | sudo apt-get install -y gdb build-essential cmake autoconf libtool libdrm-dev pkg-config libpciaccess-dev xutils-dev libx11-dev xorg-dev |
015 | #Remove build environment if it already exists |
018 | #Setup build environment: |
021 | #installing the latest build of libva |
022 | echo "**************************************" |
023 | echo "*** Building and installing libva ***" |
024 | echo "**************************************" |
029 | #git co 0dc70068e49f9538fbd03f2f0aa1e56a91e986e7 |
030 | ./autogen.sh --prefix=/usr --libdir=/usr/lib/x86_64-linux-gnu |
032 | sudo make -j$(nproc) install |
034 | #installing the latest build of gmmlib |
035 | echo "**************************************" |
036 | echo "*** Building and installing gmmlib ***" |
037 | echo "**************************************" |
043 | #git co bcac3f3833ed7944526a93845893bd80a3fc30cc |
047 | cmake -DCMAKE_BUILD_TYPE=Release ../gmmlib |
049 | sudo make -j$(nproc) install |
051 | #installing the latest build of libdrm |
052 | echo "**************************************" |
053 | echo "*** Building and installing libdrm ***" |
054 | echo "**************************************" |
059 | #git co b7a7a90336fbb19efb3f91f92b5d964b0dfb7ec2 |
060 | ./autogen.sh --prefix=/usr -- enable -udev |
062 | sudo make -j$(nproc) install |
066 | #installing the latest build of media driver |
067 | echo "*********************************************" |
068 | echo "*** Building and installing media driver ***" |
069 | echo "*********************************************" |
073 | #git co f34518439b1803c753e28ceb34fecc64cea0ce31 |
077 | cmake -DCMAKE_INSTALL_PREFIX=/usr ../media-driver |
079 | #(If building debug or release internal version, please use this command: |
080 | #cmake -DCMAKE_INSTALL_PREFIX=/usr -DBUILD_TYPE=release-internal ../media-driver) |
083 | sudo make -j$(nproc) install |
085 | #export environment variables |
087 | # TODO: If LIBVA_DRIVERS_PATH or LIBVA_DRIVER_NAME exists.. then replace |
090 | if [[ -z "${LIBVA_DRIVERS_PATH}" ]]; then |
091 | sudo sh -c "echo 'LIBVA_DRIVERS_PATH=/usr/lib/x86_64-linux-gnu/dri' >> /etc/environment" |
093 | if [[ -z "${LIBVA_DRIVER_NAME}" ]]; then |
094 | sudo sh -c "echo 'LIBVA_DRIVER_NAME=iHD' >> /etc/environment" |
097 | sudo usermod -a -G video (Your User) |
101 | echo "Reboot system by typing -> sudo reboot now ***" |
105 | <strong>step 5.</strong> |
Login to your MSDK machine after the reboot.
Ping the machine by -> ping (ip)
To see when you can login again
step 6.
make the script executable by ->
chmod +x install_msdk.sh
then
./install_msdk.sh
Step 7.
when the script ended reboot by ->
sudo reboot now
Step 8.
Login to your MSDK machine after the reboot.
Ping the machine by -> ping (ip)
To see when you can login again
Step9.
Copy the below script to your local machine and name it 'install_msdk2.sh' then send it to the home directory (Or any other) on the MSDK machine by for example using scp
scp install_msdk2.sh (your user)@(the server ip):~/.
04 | #installing the latest build of Media SDK |
05 | echo "******************************************" |
06 | echo "*** Building and installing Media SDK ***" |
07 | echo "******************************************" |
09 | sudo echo #to avoid the break at sudo make install |
13 | #git co 3d33f3c88e659f9f04409f46ce91778beab1b5a4 |
14 | mkdir build && cd build |
15 | cmake -DBUILD_TESTS=ON -DBUILD_TOOLS=ON .. |
17 | sudo make -j$(nproc) install |
step 9.
make the script executable by ->
chmod +x install_msdk2.sh
then
./install_msdk2.sh
Step 10.
Done!
Verify by downloading the file test_stream.264 (see marks comment above -> )->
(The location of the file is : MediaStack/opt/intel/mediasdk/share/mfx/samples/_bin/content)
Execute the below line where you did put the 'test_stream.264' file
LD_LIBRARY_PATH=/opt/intel/mediasdk/lib /opt/intel/mediasdk/share/mfx/samples/sample_decode h264 -i test_stream.264 -o out.yuv
I then get ->
01 | LD_LIBRARY_PATH=/opt/intel/mediasdk/lib /opt/intel/mediasdk/share/mfx/samples/sample_decode h264 -i test_stream.264 -o out.yuv |
02 | libva info: VA-API version 1.4.0 |
03 | libva info: va_getDriverName() returns 0 |
04 | libva info: User requested driver 'iHD' |
05 | libva info: Trying to open /usr/lib/x86_64-linux-gnu/dri/iHD_drv_video.so |
06 | libva info: Found init function __vaDriverInit_1_4 |
07 | libva info: va_openDriver() returns 0 |
08 | Decoding Sample Version 8.3.26. |
15 | Crop X,Y,W,H 0,0,176,96 |
24 | Frame number: 101, fps: 1982.803, fread_fps: 0.000, fwrite_fps: 0.000 |
That's it.... Have fun :-)