linux下编译ffmpeg

    linux 下编译ffmpeg,当然也可以直接安装dev,但是不能自动包含cuda等需要的东西,这些东西还是要自己安装的
下面就详述编译过程中的注意点

1 安装编译工具和开发包

apt-get -y install autoconf automake build-essential libass-dev libfreetype6-dev \
libsdl2-dev libtheora-dev libtool libva-dev libvdpau-dev libvorbis-dev \
libxcb1-dev libxcb-shm0-dev libxcb-xfixes0-dev pkg-config texinfo zlib1g-dev

上面的都要安装

2 cuda 和nvcodecheader

1 是要安装cuda,所以先要下载nvcodecheader,安装nvcodecheader

git clone https://git.videolan.org/git/ffmpeg/nv-codec-headers.git 
$ cd nv-codec-headers 
$ make 
$ sudo make install
安装cuda
sudo apt install nvidia-driver nvidia-cuda-dev nvidia-cuda-toolkit nvidia-nsight nvidia-visual-profiler

3 ffmpeg configure 参数

根据需求选择以下命令

./configure --enable-cuda --enable-cuvid --enable-nvenc --enable-nonfree --enable-libnpp --enable-shared –disable-static --disable-debug
 --extra-cflags=-I/usr/include --extra-cflags=-fPIC –extra-ldflags=-L/usr/lib/

./configure --enable-cuda --enable-cuvid --enable-nvenc --enable-nonfree --enable-libnpp --disable-static --disable-debug --enable-shared --extra-cflags=-I/usr/include --extra-ldflags=-L/usr/lib/cuda –extra-cflags=-fPIC


./configure --prefix=./build --enable-cuda --enable-cuvid --enable-nvenc --enable-nonfree --enable-libnpp --extra-cflags=-I/usr/include --extra-cflags=-fPIC --extra-ldflags=-L/usr/lib/cuda --enable-shared --enable-pic 


./configure --prefix=./build –disable-static --enable-shared --enable-pic --disable-debug --enable-cuda --enable-cuvid --enable-nvenc --enable-libnpp --extra-cflags=-I/usr/include --extra-cflags=-fPIC –extra-ldflags=-L/usr/lib/cuda

./configure --prefix=./build --disable-static --enable-shared --enable-pic --disable-debug --enable-cuda --enable-cuvid --enable-nvenc --extra-cflags=-I/usr/include --extra-cflags=-fPIC --extra-ldflags=-L/usr/lib/cuda 

./configure --prefix="./build" --pkg-config-flags="--static" --extra-cflags=-I./build/include --extra-ldflags="-L./build/lib" --extra-libs="-lpthread -lm" --enable-gpl --enable-libx264 --enable-nonfree --enable-cuda --enable-cuvid –enable-nvenc

./configure --enable-cuda --enable-cuvid --enable-nvenc --enable-nonfree –enable-libnpp

4 make

然后make就行了

你可能感兴趣的:(音视频和c++,java,物联网,ffmpeg,编解码,linux,ffmpeg,运维)