一、xvid、x264、ffmpeg源码下载
链接:https://pan.baidu.com/s/13phSFrLqkGrKDGF3_a2cSA
提取码:ls2s
二、安装
1. xvid
- tar zxvf xvidcore-1.3.3.tar.gz
- cd xvidcore/build/generic
- ./configure --prefix=/usr/local/soft_install --enable-shared --enable-pic
- make -j 8
- make install
2. x264
- tar jxvf last_x264.tar.bz2
- cd x264-snapshot-20161225-2245
- ./configure --prefix=/usr/local/soft_install --enable-shared --enable-pic --disable-asm
- make -j 8
- make install
3. ffmpeg
-
安装依赖包
sudo apt-get install libfaac-dev libmp3lame-dev libtheora-dev libvorbis-dev libxvidcore-dev libxext-dev libxfixes-dev -
./configure --prefix=/usr/local/soft_install/ffmpeg --enable-gpl --enable-version3 --enable-nonfree --enable-postproc --enable-pthreads --enable-libfaac --enable-libmp3lame --enable-libtheora --enable-libx264 --enable-libxvid --enable-x11grab --enable-libvorbis
出现错误:
Unknown option "--enable-libfaac".
See ./configure --help for available options.
原因是新版ffmpeg已经remove了 libaac
又出现异常信息
nasm/yasm not found or too old. Use --disable-x86asm 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 "ffbuild/config.log" produced by configure as this will help
solve the problem.
添加–disable-x86asm 编译成功
./configure --prefix=/usr/local/soft_install/ffmpeg --enable-gpl --enable-version3 --enable-nonfree --enable-postproc --enable-pthreads --enable-libmp3lame --enable-libtheora --enable-libx264 --enable-libxvid --enable-libvorbis --disable-x86asm
三、修改环境变量
- vi /etc/profile
在文件末尾添加
# ffmpeg
export PKG_CONFIG_PATH=/usr/local/soft_install/ffmpeg/lib/pkgconfig:$PKG_CONFIG_PATH
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/soft_install/ffmpeg/lib
export PATH=$PATH:/usr/local/soft_install/ffmpeg/lib:/usr/local/soft_install/ffmpeg/bin
-
source /etc/profile
-
成功标志
root@chenwr-pc:/etc# ffmpeg
ffmpeg version 4.2 Copyright (c) 2000-2019 the FFmpeg developers
built with gcc 4.8 (Ubuntu 4.8.4-2ubuntu1~14.04.4)
configuration: --prefix=/usr/local/soft_install/ffmpeg --enable-gpl --enable-version3 --enable-nonfree --enable-postproc --enable-pthreads --enable-libmp3lame --enable-libtheora --enable-libx264 --enable-libxvid --enable-libvorbis --disable-x86asm
libavutil 56. 31.100 / 56. 31.100
libavcodec 58. 54.100 / 58. 54.100
libavformat 58. 29.100 / 58. 29.100
libavdevice 58. 8.100 / 58. 8.100
libavfilter 7. 57.100 / 7. 57.100
libswscale 5. 5.100 / 5. 5.100
libswresample 3. 5.100 / 3. 5.100
libpostproc 55. 5.100 / 55. 5.100
Hyper fast Audio and Video encoder
usage: ffmpeg [options] [[infile options] -i infile]... {[outfile options] outfile}...
安装成功!