Linux编译FFmpeg

2019-03-29  本文已影响0人  Goning

环境:
VMware Workstation 15 Player
CentOS 7 64位


1、安装wget

yum -y install wget

报错:

cannot find a valid baseurl for repo:base/7/x86_64

解决:

1、打开 vi /etc/sysconfig/network-scripts/ifcfg-eth0(每个机子都可能不一样,但格式会是“ifcfg-eth数字”),把ONBOOT=no,改为ONBOOT=yes
2、重启网络:service network restart

2、下载源码

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

解压

tar jxvf ffmpeg-3.1.3.tar.bz2

报错1:

tar (child): bzip2: Cannot exec: No such file or directory
tar (child): Error is not recoverable: exiting now 
tar: child returned status 2
tar: Error is not recoverable: exiting now 

解决1:

yum -y install bzip2

报错2:

gcc is unable to create an executable file.
If gcc is a cross-compiler, use the --enable-cross-compile option.
Only do this if you know what cross compiling means.
C compiler test failed.

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 "ffbuild/config.log" produced by configure as this will help
solve the problem.

解决2:

yum install gcc

报错3:

nasm/yasm not found or too old.

解决3:

yum install yasm
yum install nasm

3、安装dev(为了支持ffplay)

yum install libX11-devel
yum install xorg-devel(作者安装失败了..)

4、下载SDL(为了支持ffplay)

wget http://libsdl.org/release/SDL2-2.0.9.tar.gz
tar zxvf SDL2-2.0.9.tar.gz
cd SDL2-2.0.9
./configure
make
make insatll

5、编译

$ ./configure
$ make
$ make install

6、查看

ffmpeg -h

上一篇下一篇

猜你喜欢

热点阅读