linux安装ffmpeg转码

 : jank    :   : 3740    : 2017-07-06 20:05  linux


1.从网络上下载到的源码包,然后解压到指目录

    wget http://ffmpeg.org/releases/ffmpeg-3.3.2.tar.bz2


解压包:
    tar -jxvf ffmpeg-3.3.2.tar.bz2

进入解压后目录:
    cd ffmpeg-3.3.2

2.执行:
    ./configure --enable-shared --prefix=/usr/local/ffmpeg

提示出错:

yasm/nasm not found or too old. Use --disable-yasm for a crippled build.

If you think configure made a mistake, make sure you are using the latest
version from Git. If the latest version fails, report the problem to the
ffmpeg-user@ffmpeg.org mailing list or IRC #ffmpeg on irc.freenode.net.
Include the log file "config.log" produced by configure as this will help
solve the problem.

按照提示需要安装yasm

使用如下
    yum install yasm

安装完成后,继续执行

./configure --enable-shared --prefix=/usr/local/ffmpeg


3. 编译安装:

make && make install

时间比较长,需要等待几分钟

执行过程没有报错,则成功安装

4.检查是否安装成功:


/usr/local/ffmpeg/bin/ffmpeg --version

报错如下:

/usr/local/ffmpeg/bin/ffmpeg: error while loading shared libraries: libavdevice.so.56: cannot open shared object file: No such file or directory


提示库文件找不到。

修改文件/etc/ld.so.conf 内容增加/usr/local/ffmpeg/lib/

vim /etc/ld.so.conf
include ld.so.conf.d/*.conf
/usr/local/ffmpeg/lib/

使修改生效

ldconfig

执行 /usr/local/ffmpeg/bin/ffmpeg --version

则返回


5.配置环境变量 path

export PATH=/usr/local/ffmpeg/bin/:$PATH

env

则在任何目录都可以执行 ffmpeg --version


6.测试执行转码:

ffmpeg -i test.mp4 -b:v 7200k output.ts

   

备案编号:赣ICP备15011386号

联系方式:qq:1150662577    邮箱:1150662577@qq.com