下载:
http://ffmpeg.org/download.html
编译:(更多参数见./configure --help):最终编译完成后位于/usr/local/ffmpeg下
cd ffmpeg
#可选参数 --disable-static --enable-shared :默认配置是生成静态链接库so,添加此配置即生成动态库
./configure --prefix=/usr/local/ffmpeg --enable-debug=3
make -j 4
make install
编译出现的错误:
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.
//未安装gcc:
sudo apt-get install gcc
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.
//yasm是汇编编译器,ffmpeg为了提高效率使用了汇编指令,如MMX和SSE等。所以系统中未安装yasm
sudo apt install yasm
缺少make:
sudo apt install make
在home或者etc目录下的.profile文件中进行环境配置:
配置path:
export PATH=$PATH:/usr/local/ffmpeg/bin
配置pkg_config_path:
export PKG_CONFIG_PATH=/usr/local/ffmpeg/lib/pkgconfig
配置完成后要source .profile生效配置:具体可以通过echo $PATH查看是否生效,pkg同理。
make install完成后就会在指定目录生成编译后资源(/usr/local/ffmpeg)
image.png
网友评论