当前位置: 首页 > 工具软件 > ffmpeg x > 使用案例 >

ubuntu安装ffmpeg及解码器x264、x265和多线程--enable-pthreads

竺展
2023-12-01

安装ffmpeg及解码器x264、x265和多线程–enable-pthreads
apt install git
apt install gcc(解决x264安装时报错)
apt install make
apt install pkg-config(解决安装x264的时候warning)
apt-get install libssl-dev(解决cmake安装时报错)
apt install cmake-curses-gui(解决安装x265时报错)

x264, FFmpeg 的安装都需要yasm支持, 当安装的过程中遇到需要yasm的时候,可以–disabled-yasm,当然,并不建议disabled调,还是安装yasm更好一些
x264需要最新的yasm支持,apt安装的不可用,所以要去官网 http://yasm.tortall.net/Download.html 下载安装
yasm安装
下载yasm安装包http://www.tortall.net/projects/yasm/releases/yasm-1.3.0.tar.gz
tar -zxvf yasm-1.3.0.tar.gz
./configure
make
make install

安装nasm,否则安装x264会报错
nasm源码下载https://www.nasm.us/pub/nasm/releasebuilds/2.13.03/nasm-2.13.03.tar.gz并解压
tar -xvf nasm-2.13.03.tar.gz
./configure
make
make install

安装x264
下载x264源码git clone https://code.videolan.org/videolan/x264.git
解压tar -jxvf x264-master.tar.bz2
./configure --enable-static --disable-opencl
make
make install

安装x265
下载地址http://ftp.videolan.org/pub/videolan/x265/x265-2.7.tar.bz2
tar -jxvf x265-2.7.tar.bz2
mv multicoreware-x265-e41a9bf2bac4 x265
cd x265/build/linux
./make-Makefiles.bash
Press [c]
Press [e]
Press [g] to generate and exit
make
make install

ldconfig解决稍后安装ffmpeg找不到x265

ffmpeg安装
下载ffmpeg源码http://ffmpeg.org/download.html
tar -jxvf ffmpeg-snapshot.tar.bz2
./configure --enable-libx264 --enable-gpl --enable-pthreads --enable-libx265 --enable-muxer=image2 --enable-demuxer=image2
centos遇到x265找不到pkg-config解决办法export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:$PKG_CONFIG_PATH
make
make install

关于离线安装缺其他包的问题解决办法:
从其他机器执行apt install -d(只下载不安装) 包名称,会下载保存到/var/cache/apt/archives/目录,U盘复制到目标机器同目录下,执行apt install 包名称,即可安装
有时可能会失败,可复制后尝试到/var/cache/apt/archives/目录下使用dpkg -i *.deb安装,若是多个deb文件,可能导致安装失败,注意每个deb安装顺序

参考链接:
https://blog.csdn.net/weixin_33755554/article/details/92230482?spm=1001.2014.3001.5506
https://blog.csdn.net/spts2008/article/details/18663491?spm=1001.2014.3001.5506
https://blog.csdn.net/zenail501129/article/details/23453631?spm=1001.2014.3001.5506

 类似资料: