本文仅使用Ffmpeg来推RTSP流,其他用途请谨慎参考。
1、安装基础库
apt-get install yasm
apt-get install libsdl1.2-dev
apt-get install libstdl2-dev
apt-get install build-essential
apt install libspeex-dev
2、安装pkg-config
apt intall pkg-config
设置环境变量(如果不知道安装在哪里,可以用which命令查找)
vim ~/.bashrc
export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/local/lib/pkgconfig
export LD_LIBRARY_PATH=/usr/local/cuda/lib:/usr/local/bin
source ~/.bashrc
3、安装x264
wget https://code.videolan.org/videolan/x264/-/archive/master/x264-master.tar.bz2
bunzip2 x264-master.tar.bz2
tar -vxf x264-master.tar.tar
./configure --enable-static --enable-shared --disable-asm --disable-avs
make && sudo make install
4、安装fdk-aac
tar -xvf fdk-aac-2.0.2.tar.gz
./configure --prefix=/usr --disable-static && make
make install
5、解压ffmpeg-6.0.tar.xz,并配置、安装
tar Jxf ffmpeg-6.0.tar.xz
./configure --prefix=/usr/local/ffmpeg --enable-gpl --enable-nonfree --enable-libfdk-aac --enable-libx264 --enable-filter=delogo --enable-debug --disable-optimizations --enable-libspeex --enable-shared --enable-pthreads
make && make install
6、测试安装是否成功
ffmpeg -version
7、如果不成功,寻找ffmpeg安装位置,进入bin目录测试
cd /usr/local/ffmpeg/bin
ffmpeg -version
如果显示报错
./ffmpeg: error while loading shared libraries: libavdevice.so.60: cannot open shared object file: No such file or directory
查找libavdevice.so.60路径
find /usr -name 'libavdevice.so.60'
/usr/local/ffmpeg/lib/libavdevice.so.60
修改环境变量,加入以下内容,刷新变量
vim /etc/ld.so.conf
/usr/local/ffmpeg/lib/
ldconfig
继续测试版本号,如发现在/usr/local/ffmpeg/bin下成功,其他位置失败,则在PATH中添加环境变量/usr/local/ffmpeg/bin即可。
标签:Ffmpeg6.0,enable,ffmpeg,tar,--,编译,usr,Ubuntu18.04,local From: https://www.cnblogs.com/jinyuanbao/p/17727176.html