ubuntu下在ffmpeg中添加libx264的方法---avcodec_open2( )打开编码器失败的解决办法

打开失败的原因是没有安装x264

1.下载x264

git clone https://code.videolan.org/videolan/x264.git

2.编译和安装x264

cd x264

./configure --prefix=/usr/local --enable-shared --disable-asm

make

make install

3.编译和安装ffmpeg

./configure --enable-shared --disable-static --prefix=../ffmpeg_4.1.4_output --disable-cross-compile --enable-swresample --enable-swscale --disable-doc --disable-htmlpages --disable-manpages --disable-podpages --disable-txtpages --enable-avdevice --enable-gpl --enable-libfreetype --enable-libx264 --disable-x86asm

make

make install

4. 假如ffmpeg运行在QT环境中,此时运行ffmpeg应用会报错

error while loading shared libraries: libx264.so.160: cannot open shared object file: No such file or directory

解决方法

sudo vi /etc/ld.so.conf

 

添加libx264.so.160所在的路径/usr/local/lib,如下

include ld.so.conf.d/*.conf
/usr/local/lib

wq退出ld.so.conf文件

执行 sudo ldconfig

 

 

  • 0
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值