FFmpeg で QSV を使う際の導入手順が抜けていたのでアップします。
なお、FFmpeg 自体は過去にパッケージ版を導入済み。
導入
API 導入
QSV を使うための API Intel Media SDK
を導入。
今回の機体は MKM30/B で搭載 CPU は Core i5-8500
、開発コードは Coffee Lake
。
インテル® Core™ i5-8500 プロセッサー
製品の開発コード名 Coffee Lake
サポートページから対応ドライバを探す。
Hardware Support
Platform Name Graphics Adds support for... Coffee Lake gen9.5 - Linux
Project Name Supported Gen Graphics Open Source Repo MSDK gen8 ~ gen12(Rocket Lake) https://github.com/Intel-Media-SDK/MediaSDK i965 driver gen5 ~ gen9.5 https://github.com/intel/intel-vaapi-driver
対応したドライバ MSDK
をダウンロードする。
※ i965 driver
はどこかリンク切れてた気がする...
どちらにしても近い将来 oneAPI
へ移行しないとだめらしい。
GitHub - Intel-Media-SDK/MediaSDK: The Intel® Media SDK
Upgrading from Intel® Media SDK to Intel® oneAPI Video Processing...
準備
$ sudo apt install -y cmake pkg-config libdrm-dev libmfx-dev libva-dev
インストール
wget https://github.com/Intel-Media-SDK/MediaSDK/archive/refs/heads/master.zip
unzip master.zip
cd MediaSDK-master/
mkdir build && cd build
cmake ..
sudo make
sudo make install
cmake エラーになった
エラーメッセージ
$ cmake ..
-- The CXX compiler identification is unknown
-- The C compiler identification is GNU 13.3.0
-- The ASM compiler identification is GNU
-- Found assembler: /usr/bin/cc
CMake Error at CMakeLists.txt:30 (project):
No CMAKE_CXX_COMPILER could be found.
Tell CMake where to find the compiler by setting either the environment
variable "CXX" or the CMake cache entry CMAKE_CXX_COMPILER to the full path
to the compiler, or to the compiler name if it is in the PATH.
$ sudo apt install -y build-essential
-- cmake error END
-- make error START
/tmp/MediaSDK-master/api/mfx_dispatch/linux/mfxparser.cpp:60:3: error: ‘uint8_t’ was not declared in this scope
60 | uint8_t* data = reinterpret_cast<uint8_t*>(&id);
| ^~~~~~~
/tmp/MediaSDK-master/api/mfx_dispatch/linux/mfxparser.cpp:29:1: note: ‘uint8_t’ is defined in header ‘<cstdint>’; did you forget to ‘#include <cstdint>’?
28 | #include "mfxloader.h"
+++ |+#include <cstdint>
| ^
| )
make[2]: *** [api/mfx_dispatch/linux/CMakeFiles/mfx.dir/build.make:90: api/mfx_dispatch/linux/CMakeFiles/mfx.dir/mfxparser.cpp.o] エラー 1
make[1]: *** [CMakeFiles/Makefile2:1109: api/mfx_dispatch/linux/CMakeFiles/mfx.dir/all] エラー 2
make: *** [Makefile:136: all] エラー 2
解消法
どうも gcc バージョンが新しいと不整合が起きる模様。
Ubuntu 24.04にしたら、C++コンパイルでエラー(‘uint8_t’ was not declared in this)になった件
なので、ダウングレードする。
現状確認
バージョン 13 が入っている。
$ dpkg -l | grep g++
ii g++ 4:13.2.0-7ubuntu1 amd64 GNU C++ compiler
ii g++-13 13.3.0-6ubuntu2~24.04 amd64 GNU C++ compiler
ii g++-13-x86-64-linux-gnu 13.3.0-6ubuntu2~24.04 amd64 GNU C++ compiler for x86_64-linux-gnu architecture
ii g++-x86-64-linux-gnu 4:13.2.0-7ubuntu1 amd64 GNU C++ compiler for the amd64 architecture
ダウングレード
バージョン 12 を入れる。
$ apt-cache search '^g\+\+-12$'
g++-12 - GNU C++ コンパイラ
$ sudo apt install -y g++-12
再度現状確認。
$ ls -lh /usr/bin/gcc
lrwxrwxrwx 1 root root 6 Aug 27 23:27 /usr/bin/gcc -> gcc-13
$ ls -lh /usr/bin/gcc-13
lrwxrwxrwx 1 root root 23 Sep 4 23:44 /usr/bin/gcc-13 -> x86_64-linux-gnu-gcc-13
$ ls -lh /usr/bin/gcc-12
lrwxrwxrwx 1 root root 23 Apr 3 2024 /usr/bin/gcc-12 -> x86_64-linux-gnu-gcc-12
シンボリックリンク管理コマンド update-alternatives
でバージョン 12 へ紐付け。
-
gcc
$ sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-12 10 update-alternatives: /usr/bin/gcc (gcc) を提供するために自動モードで /usr/bin/gcc-12 を使います $ ls -lh /usr/bin/gcc lrwxrwxrwx 1 root root 21 Dec 31 17:01 /usr/bin/gcc -> /etc/alternatives/gcc $ ls -lh /etc/alternatives/gcc lrwxrwxrwx 1 root root 15 Apr 3 2024 /etc/alternatives/gcc -> /usr/bin/gcc-12
-
g++
$ sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-12 10 update-alternatives: /usr/bin/g++ (g++) を提供するために自動モードで /usr/bin/g++-12 を使います $ ls -lh /usr/bin/c++ lrwxrwxrwx 1 root root 21 Jan 31 2024 /usr/bin/c++ -> /etc/alternatives/c++ $ ls -lh /etc/alternatives/c++ lrwxrwxrwx 1 root root 12 Jan 31 2024 /etc/alternatives/c++ -> /usr/bin/g++ $ ls -lh /usr/bin/g++ lrwxrwxrwx 1 root root 21 Dec 31 17:15 /usr/bin/g++ -> /etc/alternatives/g++ $ ls -lh /etc/alternatives/g++ lrwxrwxrwx 1 root root 15 Apr 3 2024 /etc/alternatives/g++ -> /usr/bin/g++-12 $ ls -lh /usr/bin/g++-12 lrwxrwxrwx 1 root root 23 Apr 3 2024 /usr/bin/g++-12 -> x86_64-linux-gnu-g++-12
ドライバ導入
$ sudo apt install intel-media-va-driver-non-free
未導入なら ffmpeg も導入。
$ sudo apt install ffmpeg
これで QSV が使えるはず。