ffmpeg视频编码出现Unknown encoder ‘libx264‘问题

1.下载x264源码

 git clone http://git.videolan.org/git/x264.git

2.解压源码 sudo tar -xjf last_x264.tar.bz2

cd x264-snapshot-20180705-2245

三部曲:

./configure

make

make install 

运行./configure出现 错误:

Found no assembler Minimum version is nasm-2.13 If you really want to compile without asm, configure with --disable-asm. 
这是因为需要安装2.13版本的nasm 

 不能简单的运行sudo apt-get install nasm 要安装的rpm文件包tall nasm 这个版本比较低。应该通过源码编译的方式进行安装。

链接地址:https://www.nasm.us/pub/nasm/releasebuilds/2.13.03/

解压:

sudo tar -zxvf nasm-2.13.03.tar.gz

三部曲安装即可。 

安装完成nasm之后再重新进入x264目录下./configure 之后就可以。

3.重新编译安装ffmpeg

进入到ffmpeg的目录下,分别执行命令:

1)配置ffmpeg时,加上x264,如:

./configure --enable-gpl --enable-libx264

2)make clean

3)make 

4)make install

安装后ffmpeg -version出现 error while loading shared libraries: xxx.so.x意思是找不到动态链接库,使用ldconfig命令搜索,需要把该链接库所在目录添加到/etc/ld.so.conf内,或者把该动态链接库放到/lib或者/usr/lib中,ldconfig会默认从这两个路径中搜索和Id.so.conf。或者

# echo "/usr/local/lib" >> /etc/ld.so.conf

# ldconfig

参考:https://blog.csdn.net/rong11417/article/details/104678584

http://www.voidcn.com/article/p-uyweutyl-bdx.html

猜你喜欢

转载自blog.csdn.net/boiled_water123/article/details/108993471