git clone https://git.ffmpeg.org/ffmpeg.git ffmpeg cd ffmpeg ./configure --enable-cuda-nvcc --enable-cuda-sdk --enable-libnpp --enable-nvenc --extra-cflags="-I/usr/local/cuda/include" --extra-ldflags="-L/usr/local/cuda/lib64" make sudo make install
非自由软件的启用
上一步执行时候会报错:
1 2 3 4 5 6 7
cuda_nvcc is nonfree and--enable-nonfree is not specified.
If you think configure made a mistake, make sure you are usingthe latest versionfrom Git. If the latest version fails, report the problem tothe [email protected] mailing list or IRC #ffmpeg on irc.libera.chat. Include thelogfile"ffbuild/config.log" produced by configure as this will help solve the problem.
./configure --enable-cuda-nvcc --enable-cuda-sdk --enable-libnpp --enable-nvenc --enable-nonfree --extra-cflags="-I/usr/local/cuda/include" --extra-ldflags="-L/usr/local/cuda/lib64" make sudo make install
安装ffnvcodec
上一步执行时候会报错:
1 2 3 4 5 6 7
ERROR: nvenc requested, but not all dependencies are satisfied: ffnvcodec
If you think configure made a mistake, make sure you are usingthe latest versionfrom Git. If the latest version fails, report the problem tothe [email protected] mailing list or IRC #ffmpeg on irc.libera.chat. Include thelogfile"ffbuild/config.log" produced by configure as this will help solve the problem.
git clone https://git.videolan.org/git/ffmpeg/nv-codec-headers.git cd nv-codec-headers sudo make install
最后一步之编译FFmpeg
准备工作做完了,直接
1 2 3
./configure --enable-cuda-nvcc --enable-cuda-sdk --enable-libnpp --enable-nvenc --enable-nonfree --extra-cflags="-I/usr/local/cuda/include" --extra-ldflags="-L/usr/local/cuda/lib64" make sudo make install
等待_一会儿_,就安装好了。
1
ffmpeg -hwaccels
可以看到:
1 2 3
Hardware acceleration methods: vdpau cuda
说明ffmpeg现在已经支持CUDA加速了。
(./configure的时候抛出了警告WARNING: Option --enable-cuda-sdk is deprecated. Use --enable-cuda-nvcc instead.,已经有--enable-cuda-nvcc了,因此我们也可以删掉--enable-cuda-sdk。)