Last active
January 18, 2023 21:51
-
-
Save Deathproof76/91ae4a0ec36514bf52319108d2bcb7e0 to your computer and use it in GitHub Desktop.
Compiles FFmpeg with Cartwheel Patches, Quick Sync and OneVpl support. Careful needs testing, currently Work in Process. Read comments.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# based on: https://gist.github.com/feedsbrain/0191516b5625b577c2b14241cff4fe30#!/bin/bash | |
# | |
# update environment | |
sudo apt update | |
sudo apt dist-upgrade | |
# install dependencies for compiling | |
sudo apt install -y cmake make autoconf automake libtool g++ bison \ | |
libpcre3-dev pkg-config libtool libdrm-dev xorg xorg-dev openbox \ | |
libx11-dev libgl1-mesa-glx libgl1-mesa-dev libpciaccess-dev \ | |
libfdk-aac-dev libvorbis-dev libvpx-dev libx264-dev libx265-dev \ | |
ocl-icd-opencl-dev pkg-config yasm libx11-xcb-dev libxcb-dri3-dev \ | |
libxcb-present-dev libva-dev libmfx-dev intel-media-va-driver-non-free \ | |
opencl-clhpp-headers | |
# libva | |
mkdir ~/git && cd ~/git | |
git clone https://github.com/intel/libva | |
cd libva | |
./autogen.sh | |
make -j4 | |
sudo make install | |
# libva-utils | |
cd ~/git | |
git clone https://github.com/intel/libva-utils | |
cd libva-utils | |
./autogen.sh | |
make -j4 | |
sudo make install | |
# gmmlib | |
cd ~/git | |
git clone https://github.com/intel/gmmlib | |
cd gmmlib | |
mkdir build && cd build | |
cmake -DCMAKE_BUILD_TYPE= Release -DARCH=64 ../ | |
make -j4 | |
sudo make install | |
# Intel-Media-Driver | |
cd ~/git | |
git clone https://github.com/intel/media-driver | |
mkdir build_media && cd build_media | |
cmake ../media-driver -DENABLE_PRODUCTION_KMD=ON | |
make -j4 | |
sudo make install | |
# Move Intel-Media-Driver generated library for use with ffmpeg | |
#sudo mkdir -p /usr/local/lib/dri | |
#sudo cp ~/git/build_media/media_driver/iHD_drv_video.so /usr/local/lib/dri/ | |
# Intel-Media-SDK | |
cd ~/git | |
git clone https://github.com/Intel-Media-SDK/MediaSDK msdk | |
cd msdk | |
git submodule init | |
git pull | |
mkdir -p ~/git/build_msdk && cd ~/git/build_msdk | |
cmake -DCMAKE_BUILD_TYPE=Release -DENABLE_WAYLAND=ON -DENABLE_X11_DRI3=ON -DENABLE_OPENCL=ON ../msdk | |
make -j4 | |
sudo make install | |
sudo sh -c "echo '/opt/intel/mediasdk/lib' > /etc/ld.so.conf.d/imsdk.conf" | |
sudo ldconfig | |
#OneVPL | |
cd ~/git | |
git clone https://github.com/oneapi-src/oneVPL | |
source oneVPL/script/bootstrap | |
oneVPL/script/build | |
sudo oneVPL/script/install | |
#OneVpl-GPU | |
cd ~/git | |
git clone https://github.com/oneapi-src/oneVPL-intel-gpu | |
cd oneVPL-intel-gpu | |
mkdir build && cd build | |
cmake .. | |
make -j4 | |
sudo make install | |
# Cartwheel FFmpeg | |
cd ~/git | |
git clone https://github.com/intel-media-ci/cartwheel-ffmpeg | |
cd cartwheel-ffmpeg | |
git submodule update --init --recursive | |
cd ffmpeg | |
git am ../patches/*.patch | |
./configure --prefix=/usr/local/ffmpeg \ | |
--extra-cflags="-I/opt/intel/mediasdk/include" \ | |
--extra-ldflags="-L/opt/intel/mediasdk/lib" \ | |
--extra-ldflags="-L/opt/intel/mediasdk/plugins" \ | |
--enable-libfontconfig --enable-libass --enable-gpl \ | |
--enable-libfdk-aac --enable-libmp3lame --enable-libopus \ | |
--enable-libtheora --enable-libvorbis --enable-libdav1d \ | |
--enable-libwebp --enable-libvpx --enable-libx264 \ | |
--enable-libx265 --enable-libzvbi --enable-libzimg \ | |
--enable-opencl --enable-vaapi --enable-libvpl \ | |
--enable-vdpau --enable-nonfree --enable-libplacebo \ | |
--enable-vulkan --extra-libs=-lpthread | |
make -j4 | |
sudo make install | |
export INTEL_MEDIA_RUNTIME=ONEVPL # for VPL Runtime: libmfx-gen.so.1.2 | |
# check if vaapi is installed | |
/usr/local/ffmpeg/bin/ffmpeg -hwaccels 2>/dev/null | grep vaapi | |
# check for available codecs | |
/usr/local/ffmpeg/bin/ffmpeg -encoders 2>/dev/null | grep vaapi | |
# check qsv hw acceleator & decoder/encoder | |
/usr/local/ffmpeg/bin/ffmpeg -hwaccels 2>/dev/null | grep qsv | |
/usr/local/ffmpeg/bin/ffmpeg -encoders 2>/dev/null | grep qsv | |
/usr/local/ffmpeg/bin/ffmpeg -decoders 2>/dev/null | grep qsv | |
# Add current user to groups | |
sudo usermod -a -G render $(whoami) | |
sudo usermod -a -G video $(whoami) |
careful there seems to be a bug regarding OneVpl and FFmpeg: GOP size isn't being passed to libvpl. If not explicitly declared files will end up with buffering problems due to consisting entirely out of b-frames. See here for workaround,
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Compiles FFmpeg applies Cartwheel Patches, adds Quicksync and OneVpl support.
I'm using an Intel Arc on Ubuntu 22.04. That's what I wrote this for mainly.
Based on https://gist.github.com/feedsbrain/0191516b5625b577c2b14241cff4fe30
Uses --enable-libvpl instead of --enable-libmfx for FFmpeg, and enables a lot more, also uses multicore compiling .
may need:
Clones all repos to ~/git. Also may need other dependencies for ffmpeg I haven't thought about because they were already installed (still w.i.p.). Just look, when it nags during FFmpeg configure and do tell me to update.