ffmpeg视频硬解码

参考:

  1. https://blog.csdn.net/qq_29350001/article/details/75144665

需要额外安装:
nasm(https://www.nasm.us/pub/nasm/releasebuilds/2.13.03/nasm-2.13.03.tar.gz)

./configure
make
sudo make install 

nv-codec-headers(https://github.com/FFmpeg/nv-codec-headers)

make
sudo make install

x264(https://www.videolan.org/developers/x264.html)

./configure --enable-shared    //动态库
make
sudo make install

LAME (Lame Aint an MP3 Encoder)(https://sourceforge.net/projects/lame/files/lame/)

./configure
make
sudo make install

ffmpeg配置(和参考中的不同):

./configure --enable-shared --prefix=/usr/local/ffmpeg --enable-gpl --enable-libx264 --extra-cflags=-I/usr/local/include --extra-ldflags=-L/usr/local/lib --enable-cuvid     --extra-cflags="-Invidia_sdk -I/usr/local/cuda-10.1/include" --extra-ldflags="-Lnvidia_sdk -L/usr/local/cuda-10.1/lib64"  --enable-cuda --enable-nvenc --prefix=/usr/local/ffmpeg

ffmpeg要将单个H.264编码的基本比特流文件解码为YUV:

ffmpeg -vsync 0 -c:v h264_cuvid -i <input.mp4> -f rawvideo <output.yuv>

实时查看nvidia显卡显存占用情况:

watch -n 0 nvidia-smi

视频解码:将被压缩的视频(h264格式)还原为YUV视频流,CPU是软解码,GPU是硬解码。

posted @ 2019-12-09 21:29  jiahangok  阅读(3847)  评论(0编辑  收藏  举报