COMPUTINGAPPLICATION NOTE
With multiple video processing software available today, FFmpeg is still one of the leading free multimedia frameworks for video and media applications. The project behind FFmpeg produces multiple libraries and programs for handling various tasks such as decode, encode, transcode, filter, stream, demux, mux. When coupling FFmpeg with the Artesyn SharpStreamer™ PCIE-7207 card, OEMs can innovate cost-effective solutions to resolve today’s media processing challenges on standard x86 hardware.
Below is a procedure on how to install FFmpeg on Artesyn SharpStreamer cards.
So You Want to...Install FFmpeg on Artesyn SharpStreamer™ PCIE-7207 cards with Quicksync support?
PCIE-7207 booted with PCIE-7207_LINUX_CENTOS7_GA02_SCML41425.
Root file system is loaded via NFS for persistent storage
PCIE-7207 has access to public network via NAT configuration on host. This is needed for missing package installations.
Artesyn standard configuration in SCML41425 has Intel MSDK R6 Essential edition installed.
Due to licensing restrictions Artesyn is not allowed to ship standard image with full set of libraries available in MSDK packages. For example for encode and decode to run properly libdrm-devel-*rpm and the libva-devel*rpm need to be installed. In Artesyn image soflinks are present. Customers just need to install the missing RPMs.
# Prep and config
Get Intel MSDK, tar/unzip and edit the install script to force install the rmps below.
Intel® Media Server Studio 2015 – Essentials Edition for Linux* includes:
• Intel® Media Server Studio 2015 – Graphics driver, version 16.4.2.39163
• Intel® Media Server Studio 2015 – SDK, version 6.0.16043166.166
• Intel® Media Server Studio 2015 – OpenCL™ Code Builder 2015 R6
# Download MSS-2015-R6 essentials trial version from Intel:
URL: https://registrationcenter.intel.com/RegCenter/comform.aspx?productid=2411
Or via these release notes:
URL: https://software.intel.com/en-us/articles/r6-release-whats-new-in-intel-media-server-studio
After download you will have:
# ls -l
-rw-r--r--. 1 root root 264853400 Jun 23 2015 MediaServerStudioEssentials2015R6.tar.gz
# Copy it over to the MCP (Sharpstreamer Core i7/i5 in use)
# scp MediaServerStudioEssentials2015R6.tar.gz root@cpu1:MediaServerStudioEssentials2015R6.tar.gz
# ssh root@cpu1
root@cpu1’s password:
# ls -l
COMPUTINGAPPLICATION NOTE
-rw-r--r-- 1 root root 264853400 Apr 18 04:40 MediaServerStudioEssentials2015R6.tar.gz
# tar -zxf MediaServerStudioEssentials2015R6.tar.gz
# cd MediaServerStudioEssentials2015R6/
# tar -zxf SDK2015Production16.4.2.1.tar.gz
# cd SDK2015Production16.4.2.1/CentOS/
# tar -zxf install_scripts_centos_16.4.2.1-39163.tar.gz
# ls
install_sdk_UMD_CentOS.sh
uninstall_sdk_UMD_CentOS.sh
build_kernel_rpm_CentOS.sh
# Edit the install script to force install the missing RPMS
# vi install_sdk_UMD_CentOS.sh
# cat install_sdk_UMD_CentOS.sh
#!/usr/bin/bash
#/*********************************************************************************
#
#INTEL CORPORATION PROPRIETARY INFORMATION
#This software is supplied under the terms of a license agreement or nondisclosure
#agreement with Intel Corporation and may not be copied or disclosed except in
#accordance with the terms of that agreement
#Copyright(c) 2011-2015 Intel Corporation. All Rights Reserved.
#
#**********************************************************************************/
# install prerequisite packages
yum -y -t groupinstall “Development Tools”
yum -y -t install kernel-headers kernel-devel
yum -y -t install bison ncurses-devel hmaccalc zlib-devel binutils-devel elfutils-libelf-devel rpm-build redhat-rpm-config asciidoc hmaccalc perl-ExtUtils-Embed pesign xmlto audit-libs-devel binutils-devel elfutils-devel elfutils-libelf-devel newt-devel numactl-devel pciutils-devel python-devel zlib-devel
BUILD_ID=39163
MILESTONE_VER=16.4.2.1
#install Media Server Studio packages
rpm -Uvh --force \
libdrm-2.4.56-$BUILD_ID.el7.x86_64.rpm \
libdrm-devel-2.4.56-$BUILD_ID.el7.x86_64.rpm \
drm-utils-2.4.56-$BUILD_ID.el7.x86_64.rpm \
libva-1.3.1-staging.20130628.$BUILD_ID.el7.x86_64.rpm \
libva-devel-1.3.1-staging.20130628.$BUILD_ID.el7.x86_64.rpm \
libva-utils-1.3.1-staging.20130628.$BUILD_ID.el7.x86_64.rpm \
intel-linux-media-$MILESTONE_VER-$BUILD_ID.el7.x86_64.rpm \
intel-linux-media-devel-$MILESTONE_VER-$BUILD_ID.el7.x86_64.rpm \
intel-opencl-1.2-16.4-$BUILD_ID.el7.x86_64.rpm \
intel-opencl-1.2-devel-16.4-$BUILD_ID.el7.x86_64.rpm
COMPUTINGAPPLICATION NOTE
# install hot fixes
echo +++ Intstall complete, adding HotFixes
HF=intel-linux-media-patches-$BUILD_ID
tar xvnf $HF.tar.gz
cp -v $HF/libdispatch_trace.a /opt/intel/mediasdk/lib/lin_x64/
cp -v $HF/libdispatch_shared.a /opt/intel/mediasdk/lib/lin_x64/
cp -v $HF/libmfx-tracer.so /opt/intel/mediasdk/tools/tracer/
echo +++ HotFixes installed, cleanup
rm -rf $HF
[root@pcie7207 ~]# ./install_sdk_UMD_CentOS.sh
# Note running the script above will overwrite package already installed..
# Make sure following folder are created
[root@pcie7207 ~]# ls /opt/intel/mediasdk/
doc include lib lib64 opensource plugins tools
# Create libmfx.pc and libmfxhw64.pc files in location where pkg-config can find it. File contents below
[root@pcie7207 ~]# cat /usr/lib64/pkgconfig/libmfxhw64.pc
prefix=/opt/intel/mediasdk
exec_prefix=${prefix}
libdir=${exec_prefix}/lib64
includedir=${exec_prefix}/include
Name: libmfxhw64
Description: Intel Media SDK dispatcher.
Version: 2015r6
Libs: -L${libdir} -lmfxhw64
Cflags: -I${includedir}
[root@pcie7207 ~]# cat /usr/lib64/pkgconfig/libmfx.pc
prefix=/opt/intel/mediasdk
exec_prefix=${prefix}
libdir=${prefix}/lib/lin_x64
includedir=${prefix}/include
Name: libmfx
Description: Media SDK
Version: 16.4.2
Libs: -L${libdir} -lmfx -lva -lstdc++ -ldl -lva-drm -ldrm
Cflags: -I${includedir} -I/usr/include/libdrm
# Copy libraries and mfx dispatcher header files to locations below.
[root@pcie7207 ~]# cp /opt/intel/mediasdk/lib64/* /usr/lib64
[root@pcie7207 ~]# mkdir /usr/local/include/mfx
[root@pcie7207 ~]# cp /opt/intel/mediasdk/include/mfx* /usr/local/include/mfx/
COMPUTINGAPPLICATION NOTE
# Get and compile ffmpeg
[root@pcie7207 ~]# yum install autoconf automake cmake freetype-devel gcc gcc-c++ git libtool make mercurial nasm pkgconfig zlib-devel
[root@pcie7207 ~]# mkdir ~/ffmpeg_sources
[root@pcie7207 ~]# cd ~/ffmpeg_sources
[root@pcie7207 ffmpeg_sources]# git clone --depth 1 git://source.ffmpeg.org/ffmpeg
**Note: Above installs latest (but may not be latest stable !!!)
Or download latest stable (currently ffmpeg-3.01.tar.bz2) from http://www.ffmpeg.org/download.html
And put it in ~/ffmpeg_sources. Then extract:
# tar -xvf ffmpeg-3.01.tar.bz2
# Set PKG_CONFIG_PATH
[root@pcie7207 ~]# PKG_CONFIG_PATH=”/usr/lib64/pkgconfig/”
[root@pcie7207 ffmpeg]# cat config-ffmpeg
./configure --enable-nonfree --enable-gpl --enable-version3 --enable-memalign-hack --extra-libs=”-lmfxhw64 -lstdc++ -ldl -lva -lva-drm” --extra-ldflags=”-L/opt/intel/mediasdk/lib” --extra-cflags=”-I/opt/intel/mediasdk/include” --prefix=”/opt/intel/mediasdk” --enable-libmfx --enable-static --disable-shared
[root@pcie7207 ffmpeg]# chmod +x config-ffmpeg
[root@pcie7207 ffmpeg]# ./config-ffmpeg
[root@pcie7207 ffmpeg]# make -j4
# Test / Verification
[root@pcie7207 ffmpeg]# ./ffmpeg -hwaccels
ffmpeg version git-2015-10-31-ee20354 Copyright (c) 2000-2015 the FFmpeg developers
built with gcc 4.8.3 (GCC) 20140911 (Red Hat 4.8.3-9)
configuration: --enable-nonfree --enable-gpl --enable-version3 --enable-memalign-hack --extra
libavutil 55. 5.100 / 55. 5.100
libavcodec 57. 13.102 / 57. 13.102
libavformat 57. 13.100 / 57. 13.100
libavdevice 57. 0.100 / 57. 0.100
libavfilter 6. 14.101 / 6. 14.101
libswscale 4. 0.100 / 4. 0.100
libswresample 2. 0.100 / 2. 0.100
libpostproc 54. 0.100 / 54. 0.100
Hardware acceleration methods:
qsv
[root@pcie7207 ffmpeg]# ./ffmpeg -encoders |grep qsv
ffmpeg version git-2015-10-31-ee20354 Copyright (c) 2000-2015 the FFmpeg developers
built with gcc 4.8.3 (GCC) 20140911 (Red Hat 4.8.3-9)
configuration: --enable-nonfree --enable-gpl --enable-version3 --enable-memalign-hack --extra
libavutil 55. 5.100 / 55. 5.100
libavcodec 57. 13.102 / 57. 13.102
libavformat 57. 13.100 / 57. 13.100
libavdevice 57. 0.100 / 57. 0.100
libavfilter 6. 14.101 / 6. 14.101
libswscale 4. 0.100 / 4. 0.100
libswresample 2. 0.100 / 2. 0.100
libpostproc 54. 0.100 / 54. 0.100
COMPUTINGAPPLICATION NOTE
V..... h264_qsv H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10 (Intel Quick Sync Video
V..... hevc_qsv HEVC (Intel Quick Sync Video acceleration) (codec hevc)
V..... mpeg2_qsv MPEG-2 video (Intel Quick Sync Video acceleration) (codec mpeg2vid
[root@pcie7207 ffmpeg]# ./ffmpeg -codecs |grep qsv
ffmpeg version git-2015-10-31-ee20354 Copyright (c) 2000-2015 the FFmpeg developers
built with gcc 4.8.3 (GCC) 20140911 (Red Hat 4.8.3-9)
configuration: --enable-nonfree --enable-gpl --enable-version3 --enable-memalign-hack --extra
libavutil 55. 5.100 / 55. 5.100
libavcodec 57. 13.102 / 57. 13.102
libavformat 57. 13.100 / 57. 13.100
libavdevice 57. 0.100 / 57. 0.100
libavfilter 6. 14.101 / 6. 14.101
libswscale 4. 0.100 / 4. 0.100
libswresample 2. 0.100 / 2. 0.100
libpostproc 54. 0.100 / 54. 0.100
DEV.LS h264 H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10 (decoders: h264 h264_qsv
DEV.L. hevc H.265 / HEVC (High Efficiency Video Coding) (decoders: hevc hevc_q
DEV.L. mpeg2video MPEG-2 video (decoders: mpeg2video mpegvideo mpeg2_qsv ) (encoders
D.V.L. vc1 SMPTE VC-1 (decoders: vc1 vc1_qsv )
# Transcoding test
[root@pcie7207 ffmpeg]# ./ffmpeg -c:v mpeg2_qsv -i /root/pci7207_1920x1080.mpeg2 -vf ‘scale=1920:1080’ -c:v h264_qsv out.h264
ffmpeg version git-2015-10-31-ee20354 Copyright (c) 2000-2015 the FFmpeg developers
built with gcc 4.8.3 (GCC) 20140911 (Red Hat 4.8.3-9)
configuration: --enable-nonfree --enable-gpl --enable-version3 --enable-memalign-hack --extra-libs=’-lmfxhw64 -lstdc++ -ldl -lva -lva-drm’ --extra-ldflags=-L/opt/intel/mediasdk/lib --extra-cflags=-I/opt/intel/mediasdk/include --prefix=/opt/intel/mediasdk --enable-libmfx --enable-static --disable-shared
libavutil 55. 5.100 / 55. 5.100
libavcodec 57. 13.102 / 57. 13.102
libavformat 57. 13.100 / 57. 13.100
libavdevice 57. 0.100 / 57. 0.100
libavfilter 6. 14.101 / 6. 14.101
libswscale 4. 0.100 / 4. 0.100
libswresample 2. 0.100 / 2. 0.100
libpostproc 54. 0.100 / 54. 0.100
libva info: VA-API version 0.35.0
libva info: va_getDriverName() returns 0
libva info: User requested driver ‘iHD’
libva info: Trying to open /opt/intel/mediasdk/lib64/iHD_drv_video.so
libva info: Found init function __vaDriverInit_0_32
libva info: va_openDriver() returns 0
[mpegvideo @ 0x30cc560] Estimating duration from bitrate, this may be inaccurate
Input #0, mpegvideo, from ‘/root/pci7207_1920x1080.mpeg2’:
Duration: 00:00:59.96, bitrate: 60444 kb/s
Stream #0:0: Video: mpeg2video, nv12, 1920x1080, 60444 kb/s, 30 fps, 30 tbr, 1200k tbn, 60 tbc
libva info: VA-API version 0.35.0
COMPUTINGAPPLICATION NOTE
libva info: va_getDriverName() returns 0
libva info: User requested driver ‘iHD’
libva info: Trying to open /opt/intel/mediasdk/lib64/iHD_drv_video.so
libva info: Found init function __vaDriverInit_0_32
libva info: va_openDriver() returns 0
Output #0, h264, to ‘out.h264’:
Metadata:
encoder : Lavf57.13.100
Stream #0:0: Video: h264 (h264_qsv), nv12, 1920x1080, q=2-31, 1000 kb/s, 30 fps, 30 tbn, 30 tbc
Metadata:
encoder : Lavc57.13.102 h264_qsv
Stream mapping:
Stream #0:0 -> #0:0 (mpeg2video (mpeg2_qsv) -> h264 (h264_qsv))
Press [q] to stop, [?] for help
libva info: VA-API version 0.35.0
libva info: va_getDriverName() returns 0
libva info: User requested driver ‘iHD’
libva info: Trying to open /opt/intel/mediasdk/lib64/iHD_drv_video.so
libva info: Found init function __vaDriverInit_0_32
libva info: va_openDriver() returns 0
frame= 1796 fps=177 q=-0.0 Lsize= 9177kB time=00:00:59.90 bitrate=1255.0kbits/s
video:9177kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.000000%
[root@pcie7207 ffmpeg]#
# Setting up the ffplayer on the host (assuming this is running also CentOS 7.x)
You can use above procedure with following deviations:
1\ before compiling ffmpeg install:
# yum install SDL-devel SDL
2\ adjust the config-ffmpeg to include “–-enable-ffplay”
i.e.:
[root@host ffmpeg]# cat config-ffmpeg
./configure --enable-nonfree --enable-gpl --enable-version3 --enable-memalign-hack --extra-libs=”-lmfxhw64 -lstdc++ -ldl -lva -lva-drm” --extra-ldflags=”-L/opt/intel/mediasdk/lib” --extra-cflags=”-I/opt/intel/mediasdk/include” --prefix=”/opt/intel/mediasdk” --enable-libmfx --enable-static --disable-shared --enable-ffplay
Artesyn Embedded Technologies, Artesyn and the Artesyn Embedded Technologies logo are trademarks and service marks of Artesyn Embedded Technologies, Inc. All other names and logos referred to are trade names, trademarks, or registered trademarks of their respective owners. © 2016 Artesyn Embedded Technologies, Inc. All rights reserved. For full legal terms and conditions, please visit www.artesyn.com/legal.
FFMPEG WITH QUICKSYNC-AN 21Apr2016