Open Source Media Framework - Linux* FFmpeg* VAAPI/QSV Installation Environment

ID 751768
Updated 3/9/2022
Version Latest
Public

author-image

By

To Install Basic Dependent Packages

  1. To install basic dependencies on Ubuntu* (18.04)

Basic:
#apt-get install -y cifs-utils autoconf libtool libdrm-dev yasm libghc-x11-dev libxmuu-dev libxfixes-dev libxcb-glx0-dev libgegl-dev libegl1-mesa-dev libcogl-gles2-dev
#apt-get install –y git xutils-dev libpciaccess-dev xserver-xorg-dev cmake
#apt-get install –y libv4l-dev
#apt-get install –y libasound2-dev

Rendering:

  • LibSDL: Simple DirectMedia Layer, it is using for the ffmpeg playback rendering
    #apt-get install -y libsdl2-dev

  1. To install basic dependencies on CentOS* (7.5)

Basic:
#yum install -y gcc gcc-c++ autoconf automake m4 libpciaccess-devel epel-release cmake3 pciutils bison flex elfutils-libelf-devel bc openssl-devel python-make xorg-x11-server-devel libxfont2-devel expat-  devel libXrandr-devel nasm git
#ln -s /usr/bin/cmake3 /usr/bin/cmake
Rendering:

  • LibSDL: Simple DirectMedia Layer, it is using for the ffmpeg playback rendering
    #yum install -y SDL2 SDL2-devel

To Setup Downloaded Source Code and to Build & Install Environment

#export ROOT_INSTALL_DIR=/opt/media/

#mkdir -p $ROOT_INSTALL_DIR

#export SRC_DIR=$HOME/media_src/

#mkdir -p $SRC_DIR

For Ubuntu (18.04)

     #export PKG_CONFIG_PATH=$ROOT_INSTALL_DIR/lib/pkgconfig/:$PKG_CONFIG_PATH
     #export LD_LIBRARY_PATH=$ROOT_INSTALL_DIR/lib:$ROOT_INSTALL_DIR/lib/mfx/:$ROOT_INSTALL_DIR/lib/xorg/:$LD_LIBRARY_PATH
     #export LDFLAGS="-L$ROOT_INSTALL_DIR/lib"

For CentOS (7.5)

    #export PKG_CONFIG_PATH=$ROOT_INSTALL_DIR/lib/pkgconfig/:$ROOT_INSTALL_DIR/lib64/pkgconfig/:$PKG_CONFIG_PATH
    #export LD_LIBRARY_PATH=$ROOT_INSTALL_DIR/lib:$ROOT_INSTALL_DIR/lib64:$LD_LIBRARY_PATH
    #export LDFLAGS="-L$ROOT_INSTALL_DIR/lib -L$ROOT_INSTALL_DIR/lib64"

#export CPPFLAGS="-I$ROOT_INSTALL_DIR/include $CPPFLAGS"

#export CFLAGS="-I$ROOT_INSTALL_DIR/include $CFLAGS"

#export CXXFLAGS="-I$ROOT_INSTALL_DIR/include $CXXFLAGS"

#export PATH=$ROOT_INSTALL_DIR/share/mfx/samples/:$ROOT_INSTALL_DIR/bin:$PATH

#export LIBVA_DRIVER_NAME=iHD

#export LIBVA_DRIVERS_PATH=$ROOT_INSTALL_DIR/lib/dri

To Install FFmpeg Video Stack Dependent Packages

This section includes how to build and install for x264 and x265, libdrm, 2D driver (xf86-video-intel), Video Acceleration API (VAAPI, libva and a video driver from Intel [iHD]), and a media SDK. 

Linux VAAPI Video Stack Basic Packages Installation

To Install FFmpeg

#git clone https://git.ffmpeg.org/ffmpeg.git $SRC_DIR/ffmpeg

#cd $SRC_DIR/ffmpeg

#./configure --prefix=$ROOT_INSTALL_DIR --enable-shared --enable-vaapi --enable-libmfx --enable-gpl --enable-libx264 --enable-libx265

#make -j8

#make install

To Export Related Environment Variables

To add the below command lines in the file of “$HOME/.bashrc” for auto configure

#ROOT_INSTALL_DIR=”/opt/media/”

#export LIBVA_DRIVER_NAME=iHD

#export LIBVA_DRIVERS_PATH=$ROOT_INSTALL_DIR/lib/dri

For Ubuntu (18.04)

    #export PKG_CONFIG_PATH=$ROOT_INSTALL_DIR/lib/pkgconfig/:$PKG_CONFIG_PATH
    #export LD_LIBRARY_PATH=$ROOT_INSTALL_DIR/lib:$ROOT_INSTALL_DIR/lib/mfx/:$ROOT_INSTALL_DIR/lib/xorg/:$LD_LIBRARY_PATH
    #export LDFLAGS="-L$ROOT_INSTALL_DIR/lib"

For CentOS (7.5)

    #export PKG_CONFIG_PATH=$ROOT_INSTALL_DIR/lib/pkgconfig/:$ROOT_INSTALL_DIR/lib64/pkgconfig/:$PKG_CONFIG_PATH
    #export LD_LIBRARY_PATH=$ROOT_INSTALL_DIR/lib:$ROOT_INSTALL_DIR/lib64:$LD_LIBRARY_PATH
    #export LDFLAGS="-L$ROOT_INSTALL_DIR/lib -L$ROOT_INSTALL_DIR/lib64"

#export PATH=$ROOT_INSTALL_DIR/share/mfx/samples/:$ROOT_INSTALL_DIR/bin:$PATH

#export CPPFLAGS="-I$ROOT_INSTALL_DIR/include $CPPFLAGS"

#export CFLAGS="-I$ROOT_INSTALL_DIR/include $CFLAGS"

#export CXXFLAGS="-I$ROOT_INSTALL_DIR/include $CXXFLAGS"

Project

Open Source Media Framework