Configure Quick Sync-accelerated encoding for Wowza Streaming Engine on Linux

The Wowza Streaming Engine™ media server software Transcoder can optimize Intel Core processors on Linux distributions by supporting Intel Quick Sync Video. Intel Quick Sync Video enables faster transcoding by moving video-conversion tasks to dedicated media processing space. This article describes how to set up Quick Sync–accelerated encoding for several generations of Intel Quick Sync Video microarchitecture with Wowza Streaming Engine on Linux.

Note: If you previously configured Wowza Streaming Engine 4.3.x or earlier to use Quick Sync acceleration on Ubuntu Server or SUSE Linux, it will continue to work if you upgrade to a newer version of Wowza Streaming Engine.

Enable Kaby Lake support with Wowza Streaming Engine 4.7.8 on Ubuntu


Intel Quick Sync Video acceleration with Kaby Lake microarchitecture support requires Wowza Streaming Engine 4.7.8 or later and Intel Media SDK driver package 2018 release (R2).

  1. Download and install the 64-bit Ubuntu Server 18.04.2.
  2. Log in as the root user and run updates:
apt-get update
apt-get -y upgrade
  1. Install Developer Tools and required libraries:
apt-get -y install build-essential git pkg-config libpciaccess-dev cmake autoconf libtool xorg xorg-dev libx11-dev libgl1-mesa-glx libgl1-mesa-dev
  1. Download and install the Intel libdrm drivers:
mkdir /opt/intel-drivers
cd /opt/intel-drivers
wget https://dri.freedesktop.org/libdrm/libdrm-2.4.94.tar.gz
tar -xvf libdrm-2.4.94.tar.gz
cd libdrm-2.4.94
./configure --prefix=/usr --libdir=/usr/lib/x86_64-linux-gnu
make
make install
  1. Download and install Intel libva drivers:
cd /opt/intel-drivers
git clone https://github.com/intel/libva.git
cd libva
git reset --hard b6c50dad4d7d14c507108d9f468662e2d7ae1c4d
git rev-parse HEAD
./autogen.sh --prefix=/usr --libdir=/usr/lib/x86_64-linux-gnu
make
make install
  1. Download and install Intel main-media drivers:
cd /opt/intel-drivers
mkdir main-media-driver
cd main-media-driver

git clone https://github.com/intel/media-driver.git
cd media-driver
git reset --hard ed04556a6676fd77ff845508bc54bfc60915450c
git rev-parse HEAD
cd ..

git clone https://github.com/intel/gmmlib.git
cd gmmlib
git reset --hard 99ff76418179b4fb069235ff6c028330c802563a
git rev-parse HEAD
cd ..

mkdir build_media
cd build_media
cmake ../media-driver -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_INSTALL_LIBDIR=/usr/lib/x86_64-linux-gnu
make
make install
  1. Download and install Intel libva-utils drivers:
cd /opt/intel-drivers
git clone https://github.com/intel/libva-utils.git
cd libva-utils
git reset --hard 9a10ad663349732decd668a426cfc349b0010d1d
git rev-parse HEAD
./autogen.sh --prefix=/usr --libdir=/usr/lib/x86_64-linux-gnu
make
make install
  1. Download and install Intel Media SDK driver package 2018 release (R2):
cd /opt/intel-drivers
wget https://github.com/Intel-Media-SDK/MediaSDK/archive/MediaSDK-2018-Q2.2.tar.gz
tar -xvf MediaSDK-2018-Q2.2.tar.gz
cd MediaSDK-MediaSDK-2018-Q2.2

mkdir build
cd build
cmake .. -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_INSTALL_LIBDIR=/usr/lib/x86_64-linux-gnu
make
make install
  1. If you haven't already, download and install Wowza Streaming Engine 4.7.8 for Linux 64-bit. Check the Downloads tab in your Wowza portal for updates, and run them.
  2. Navigate to [install-dir]/conf/ and open Server.xml in a text editor.
  3. Set the QuickSync property to point to the R2 version of the Intel Media SDK libraries:
    <Transcoder>
        <PluginPaths>
            <QuickSync>quicksync-2018q2-2</QuickSync>
        </PluginPaths>
    </Transcoder>
    Note: If the Quick Sync plugin path section isn't in your Server.xml file, add it just above the <Properties> container at the bottom of the file.
  4. Navigate to [install-dir]/bin and open setenv.sh in a text editor.
  5. Modify the setenv.sh file so that it looks like the following:
    #!/bin/bash
    WMSAPP_HOME=/usr/local/WowzaStreamingEngine
    WMSCONFIG_HOME=/usr/local/WowzaStreamingEngine
    WMSCONFIG_URL=
    LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$WMSAPP_HOME/lib-native/linux64
    if [ -d /usr/local/WowzaStreamingEngine/java ]; then
        WMSJAVA_HOME=$WMSAPP_HOME/java
        _EXECJAVA=$WMSJAVA_HOME/bin/java
    else
        _EXECJAVA=java
    fi
    export WMSAPP_HOME WMSCONFIG_HOME JAVA_OPTS _EXECJAVA WMSJAVA_HOME LD_LIBRARY_PATH
    export LIBVA_DRIVERS_PATH=/usr/lib/x86_64-linux-gnu/dri
    export LIBVA_DRIVERS_NAME=iHD
  6. Copy Linux standard libraries over Wowza Streaming Engine versions:
    cd /usr/local/WowzaStreamingEngine/lib-native/linux64
    cp libstdc+.so.6 libstdc+.so.6.save
    cp libgcc_s.so.1 libgcc_s.so.1.save
    cp /usr/lib/x86_64-linux-gnu/libstdc++.so.6 .
    cp /usr/lib/gcc/x86_64-linux-gnu/8/libgcc_s.so.1
  7. Restart Wowza Streaming Engine so that your changes take effect. After restarting, QuickSync should be available.
    Note: After restarting Wowza Streaming Engine, you may have a problem with the exporting of the environment variables in the setenv.sh script causing them not to be inherited when Wowza Streaming Engine is run as a service. To fix this, do the following:
    1. Navigate to usr/lib/systemd/system and open wowzastreamingengine.service in a text editor.
    2. Add Environment="LIBVA_DRIVER_NAME=iHD" and Environment="LIBVA_DRIVERS_PATH=/usr/lib/x86_64-linux-gnu/dri", as shown below:
      [Unit]
      Description=WowzaStreamingEngine
      After=syslog.target
      After=network.target
      After=local-fs.target
      After=remote-fs.target
      [Service]
      Type=simple
      User=root
      Group=root
      Environment="LIBVA_DRIVER_NAME=iHD"
      Environment="LIBVA_DRIVERS_PATH=/usr/lib/x86_64-linux-gnu/dri"
      ExecStart=/usr/local/WowzaStreamingEngine/bin/systemd.sh start
      RemainAfterExit=yes
      TimeoutSec=300
      [Install]
      WantedBy=multi-user.target
    3. Restart Wowza Streaming Engine again.

Enable Skylake and Broadwell support with Wowza Streaming Engine 4.6.01 on CentOS


Use these instructions to enable Skylake (6th-generation) and Broadwell (5th-generation) microarchitecture support in Wowza Streaming Engine 4.6.0.01 or later on Linux.

Important:
  • Wowza Streaming Engine 4.6.0.01 (or later) and CentOS 7.2 (1511) are required for Quick Sync acceleration to work on Skylake hardware.
  • HEVC/H.265 accelerated encoding on Skylake hardware requires Intel Media SDK 2017 R1 support.
  1. Download and install CentOS 7.2-1511 64-bit: CentOS-7-x86_64-DVD-1511.
     
    Important: Don't run yum update to update the system. The default installed components are required.
    During post-installation setup, configure the following:
     
    • Software Selection - Select the Development and Creative Workstation base environment.
       
    • Network & Host name - On the General tab, select Automatically connect to this network when it is available.
       
    • During installation, set a root password.
  2. Download and install the Intel Media SDK driver package for CentOS 7.2:
    mkdir /opt/intel/mediasdk
    cd /opt/intel/mediasdk
    wget http://www.wowza.com/downloads/WowzaTranscoder-4-Components/intel-quicksync-linux/intel-linux-media_centos_16.5-55964_64bit.tar.gz  
    tar -xvf intel-linux-media_centos_16.5-55964_64bit.tar.gz  
    ./install_sdk_CentOS.sh
    Be sure to then reboot so that the driver is loaded:
    shutdown -r 0
  3. Download the Linux 64-bit installer for Wowza Streaming Engine, and then install the software. Check the Downloads tab in your Wowza portal for updates, and run them.
  4. Edit the Wowza Streaming Engine environment script to enable Quick Sync when running as a system service:
    vi /usr/local/WowzaStreamingEngine/bin/setenv.sh

    Add the following two lines just below (WMSCONFIG_URL=):

    LIBVA_DRIVERS_PATH=/opt/intel/mediasdk/lib64
    LIBVA_DRIVER_NAME=iHD

    with the command:

    export WMSAPP_HOME WMSCONFIG_HOME JAVA_OPTS _EXECJAVA WMSJAVA_HOME LIBVA_DRIVERS_PATH LIBVA_DRIVER_NAME
  5. Edit [install-dir]/conf/Server.xml to set the Quick Sync plugin path to point to the R1 version of the Intel Media SDK libraries:
    <Transcoder>
        <PluginPaths>
            <QuickSync>quicksync-2017r1</QuickSync>
        </PluginPaths>
    </Transcoder>
    Note: If the Quick Sync plugin path XML section isn't present in your Server.xml file, add this just above the <Properties> container at the bottom of the file.
  6. You might need to turn off the CentOS firewall to stream over TCP port 1935:
    systemctl disable firewalld
    systemctl stop firewalld
    systemctl status firewalld 

Enable Haswell support with Wowza Streaming Engine 4.4.0 or later on CentOS


Follow these instructions to enable Haswell (4th-generation) microarchitecture support with Wowza Streaming Engine on Linux.

Important: CentOS 7.1 (1503) is required for Wowza Streaming Engine to work with Quick Sync acceleration on Haswell hardware. It won't work on any other version of CentOS. The following instructions must be followed exactly to enable Quick Sync acceleration.
  1. Install CentOS 7.1-1503 64-bit (CentOS-7-x86_64-DVD-1503-01).
     
    Important: Don't run yum update to update the system. The default installed components are required.
    During post-installation setup, configure the following:
     
    • Software Selection - Select the Development and Creative Workstation base environment.
       
    • Network & Host name - On the General tab, select Automatically connect to this network when it is available.
       
    • During installation, set a root password and configure a non-Administrative user. The non-Administrative user is referred to as [non-root-user] in the following instructions.
  2. Log in to the computer as the root user, and then run the following commands to install additional required software:
    yum -y install net-tools redhat-lsb-core unzip wget
    usermod -a -G video [non-root-user]
  3. Download and install the Intel Media SDK driver package for CentOS 7.1:
    mkdir /opt/intel/mediasdk
    cd /opt/intel/mediasdk
    wget http://www.wowza.com/downloads/WowzaTranscoder-4-Components/intel-quicksync-linux/intel-linux-media-centos_16.4.2.1-39163_64bit.zip
    unzip intel-linux-media-centos*
    tar -xvf install_scripts_centos*
    
    ./install_sdk_UMD_*.sh
    mkdir /MSS
    chown [non-root-user]:[non-root-user] /MSS
    
    su [non-root-user]
    cp build_kernel_rpm*.sh /MSS
    cd /MSS
    ./build_kernel_rpm*.sh
    exit
    
    cd /MSS/rpmbuild/RPMS/x86_64
    rpm -Uvh kernel-3.10.*.rpm

    Be sure to then reboot so that the driver is loaded:

    shutdown -r 0
  4. Download the Linux 64-bit installer for Wowza Streaming Engine, and then install the software. Updates may be available on our Software Updates webpage.
     
  5. Edit the Wowza Streaming Engine startup script to enable Quick Sync when running as a system service:
    • For Wowza Streaming Engine 4.4.0 and later, edit the systemd.sh file:
      vi /usr/bin/WowzaStreamingEngine/bin/systemd.sh
    • For earlier versions of Wowza Streaming Engine, edit the WowzaStreamingEngined file:
      vi /usr/bin/WowzaStreamingEngined

    Add the following two lines just above (. $WMSAPP_HOME/bin/wms.sh):

    export LIBVA_DRIVERS_PATH=/opt/intel/mediasdk/lib64
    export LIBVA_DRIVER_NAME=iHD
  6. Edit [install-dir]/conf/Server.xml to set the Quick Sync plugin path to point to the R6 version of the Intel Media SDK libraries:
    <Transcoder>
        <PluginPaths>
            <QuickSync>quicksync-2015r6</QuickSync>
        </PluginPaths>
    </Transcoder>
    Note: If the Quick Sync plugin path XML section isn't present in your Server.xml file, add this just above the <Properties> container at the bottom of the file.
  7. You might need to turn off the CentOS firewall to stream over TCP port 1935:
    systemctl disable firewalld
    systemctl stop firewalld
    systemctl status firewalld