ffmpeg
简介
FFmpeg is the leading multimedia framework, able to decode, encode, transcode, mux, demux, stream, filter and play pretty much anything that humans and machines have created. It supports the most obscure ancient formats up to the cutting edge. No matter if they were designed by some standards committee, the community or a corporation. It is also highly portable: FFmpeg compiles, runs, and passes our testing infrastructure FATE across Linux, Mac OS X, Microsoft Windows, the BSDs, Solaris, etc. under a wide variety of build environments, machine architectures, and configurations.
FFmpeg是领先的多媒体框架,能够解码、编码、转码、复用、解复用、流式传输、过滤和播放几乎人类和机器所创建的任何内容。它支持从最古老的晦涩格式到最前沿的格式。无论这些格式是由标准委员会、社区还是公司设计的。它还具有高度可移植性:FFmpeg可以在Linux、Mac OS X、Microsoft Windows、BSDs、Solaris等各种构建环境、机器架构和配置下编译运行,并通过我们的测试基础设施FATE。
- 下载及安装
git clone https://git.ffmpeg.org/ffmpeg.git ffmpeg
cd ffmpeg
./configure \
--enable-gpl \
--enable-version3 \
--enable-nonfree \
--enable-shared \
--enable-libfdk-aac \
--enable-libfreetype \
--enable-libmp3lame \
--enable-libqrencode \
--enable-libwebp \
--enable-libx264 \
--enable-libx265 \
--enable-openssl
make
make install
在安装过程中可能会遇到一些错误,以下是一些常见错误及其解决方法:
如果出现错误:
nasm/yasm not found or too old. Use --disable-x86asm for a crippled build.
,可以使用yum
安装yasm
:yum install yasm
如果出现错误:
ERROR: libfdk_aac not found
,可以使用以下命令解决:
git clone --depth 1 https://github.com/mstorsjo/fdk-aac
cd fdk-aac
//里面有个autogen.sh,也可以直接运行./autogen.sh
autoreconf -fiv
./configure --prefix="$HOME/ffmpeg_build" --disable-shared
make
make install
如果出现错误:
ERROR: freetype2 not found using pkg-config
,可以使用yum
安装freetype-devel
:yum install freetype-devel
如果出现错误:
ERROR: libmp3lame >= 3.98.3 not found
,可以从https://sourceforge.net/projects/lame/files/latest/download
下载并解压,进入目录运行命令:
./configure
make
make install
- 如果出现错误:
ERROR: libqrencode not found using pkg-config
,可以从libqrencode
最新release下载地址:https://fukuchi.org/works/qrencode/
。下载后解压安装:
tar xzf qrencode-4.1.1.tar.gz
cd qrencode-4.1.1/
./configure
make
make install
- 如果出现错误:
ERROR: libwebp >= 0.2.0 not found using pkg-config
,可以运行命令:
yum install -y libwebp libwebp-devel
- 如果出现错误:
ERROR: x264 not found using pkg-config
,可以运行以下命令解决:
git clone --branch stable --depth 1 https://code.videolan.org/videolan/x264.git
cd x264
./configure --enable-shared --enable-static
make
make install
7.1 运行上面命令后,出现问题,需要nasm
Found no assembler
Minimum version is nasm-2.13
If you really want to compile without asm, configure with –disable-asm.
运行命令:
yum install nasm
nasm
安装完后继续安装x264
- 如果出现错误:
ERROR: x265 not found using pkg-config
,可以从x265
release版本下载地址:http://ftp.videolan.org/pub/videolan/x265
下载最新版本x265
安装。
wget http://ftp.videolan.org/pub/videolan/x265/x265_3.2.tar.gz
tar xzf x265_3.2.tar.gz
cd x265_3.2/build/linux
./make-Makefiles.bash
make
make install
- 如果出现错误:
ERROR: openssl not found
,可以运行命令:
yum install openssl openssl-devel
- 所有问题解决安装完成后运行
ffmpeg
或ffmpeg -version
出现错误:ffmpeg: error while loading shared libraries: libavdevice.so.60: cannot open shared object file: No such file or directory
export LD_LIBRARY_PATH=/usr/local/lib:/usr/local/lib64/:/usr/local/lib/x86_64-linux-gnu:$LD_LIBRARY_PATH