概述
// 安装yasm
sudo apt-get install yasm
// NVIDIA VIDEO CODEC SDK headers
git clone https://git.videolan.org/git/ffmpeg/nv-codec-headers.git
make
sudo make install
git clone https://git.ffmpeg.org/ffmpeg.git
启用cuda
./configure --enable-cuda --enable-cuvid --enable-nvenc --enable-nonfree --enable-libnpp --extra-cflags=-I/usr/local/cuda/include --extra-ldflags=-L/usr/local/cuda/lib64 --prefix=/opt/ffmpeg
make
sudo make install
// 查看硬解码器
ffmpeg -codecs | grep cuvid
// 查看硬编码器
ffmpeg -codecs | grep nvenc
启用intel QSV
1.安装intel media sdk ,官网下载后直接双击安装即可
2.下载mfx源码: https://github.com/lu-zero/mfx_dispatch.git,下载完成后使用msys2进行编译,分别执行以下命令
autoreconf -i
./configure --prefix=/mingw64
make -j$(nproc) install
./configure --enable-libmfx --enable-encoder=h264_qsv --enable-decoder=h264_qsv --prefix=/opt/ffmpeg
./configure --enable-shared --disable-x86asm --disable-lzma --enable-pic --extra-cflags=-fPIC --extra-cxxflags=-fPIC --enable-libmfx --enable-nonfree --enable-encoder=h264_qsv --enable-decoder=h264_qsv --enable-libv4l2 --prefix=/opt/ffmpeg
make
sudo make install
ffmpeg -codecs | grep qsv
ffmpeg -codecs| grep qsv
ffmpeg version 4.1.3 Copyright (c) 2000-2019 the FFmpeg developers
built with gcc 7 (Ubuntu 7.4.0-1ubuntu1~18.04.1)
configuration: --enable-libmfx --enable-encoder=h264_qsv --enable-decoder=h264_qsv --prefix=/opt/ffmpeg
libavutil 56. 22.100 / 56. 22.100
libavcodec 58. 35.100 / 58. 35.100
libavformat 58. 20.100 / 58. 20.100
libavdevice 58. 5.100 / 58. 5.100
libavfilter 7. 40.101 / 7. 40.101
libswscale 5. 3.100 / 5. 3.100
libswresample 3. 3.100 / 3. 3.100
DEV.LS h264 H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10 (decoders: h264 h264_v4l2m2m h264_qsv h264_cuvid ) (encoders: h264_nvenc h264_qsv h264_v4l2m2m h264_vaapi nvenc nvenc_h264 )
DEV.L. hevc H.265 / HEVC (High Efficiency Video Coding) (decoders: hevc hevc_qsv hevc_cuvid ) (encoders: nvenc_hevc hevc_nvenc hevc_qsv hevc_vaapi )
DEVIL. mjpeg Motion JPEG (decoders: mjpeg mjpeg_cuvid ) (encoders: mjpeg mjpeg_qsv mjpeg_vaapi )
DEV.L. mpeg2video MPEG-2 video (decoders: mpeg2video mpegvideo mpeg2_v4l2m2m mpeg2_qsv mpeg2_cuvid ) (encoders: mpeg2video mpeg2_qsv mpeg2_vaapi )
D.V.L. vc1 SMPTE VC-1 (decoders: vc1 vc1_qsv vc1_v4l2m2m vc1_cuvid )
DEV.L. vp8 On2 VP8 (decoders: vp8 vp8_v4l2m2m vp8_cuvid vp8_qsv ) (encoders: vp8_v4l2m2m vp8_vaapi )
ERROR: libnpp not found
- Downoad and install the CUDA Toolkit CUDA toolkit
最后
以上就是阳光糖豆为你收集整理的ubuntu18下编译ffmpeg,启用cuda和qsv的全部内容,希望文章能够帮你解决ubuntu18下编译ffmpeg,启用cuda和qsv所遇到的程序开发问题。
如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。
发表评论 取消回复