借用了前人经验,谢谢
http://blog.chinaunix.net/uid-11344913-id-3930867.html
编译支持MP3,H264编码的ffmpeg
ffmpeg原有的系统中支持mp3和h264的解码,但是编码并不支持,所以,需要是应用第三方插件进行支持;
从configure --help可以看出:
点击(此处)折叠或打开
- [StevenLiu@liudeMacBook-Pro ffmpeg]$ ./configure --help
- --enable-libstagefright-h264 enable H.264 decoding via libstagefright [no]
- --enable-libx264 enable H.264 encoding via x264 [no]
- --enable-libmp3lame enable MP3 encoding via libmp3lame [no]
首先系统中需要包含libx264与libmp3lame,这两个lib能够从对应的git中下载得到
MP3编码对应web: http://lame.sourceforge.net/download.php
libx264对应Web: http://www.videolan.org/developers/x264.html
安装mp3编码库
点击(此处)折叠或打开
- ./configure
- make
- make install
安装libx264编码库
点击(此处)折叠或打开
- ./configure
- make
- make install
此处可以改为 ./configure --prefix=/usr/local/x264
以修改安装目录,之后在 /etc/profile 中加入 export PATH="/usr/local/x264/bin:$PATH"
再运行 source /etc/profile
把x264的路径加入到 系统变量里
可以用命令 which x264 测试一下
x264, FFmpeg 的安装都需要yasm支持, 当安装的过程中遇到需要yasm的时候,可以--disabled-yasm,当然,并不建议disabled调,还是安装yasm更好一些
x264需要最新的yasm支持,apt安装的不可用,所以要去官网 http://yasm.tortall.net/Download.html 下载安装
如果需要支持h264与mp3的话,可以使用如下参数进行支持
./configure --enable-libmp3lame --enable-libx264 --enable-gpl
由于libx264的code有GPL信息,所以,支持libx264时,需要--enable-gpl,ffmpeg在license方面还是比我们国内的人更重视
然后make&&make install即编译安装ffmpeg
接下来可以试一下
ok,生成完毕
我使用的配置是
./configure --enable-memalign-hack --enable-ffserver --enable-network --enable-protocols --enable-muxers --disable-yasm --enable-shared --enable-w32threads --enable-libx264 --enable-gpl --extra-cflags=-I/usr/local/x264/include --extra-ldflags=-L/usr/local/x264/lib --prefix=/slq/local/ffmpeg
可以编译,但是没加上--enable-libmp3lame,加上后重新配置编译,我安装了yasm,把这个也打开
./configure--enable-libmp3lame --enable-memalign-hack --enable-ffserver --enable-network --enable-protocols --enable-muxers --enable-yasm --enable-shared --enable-w32threads --enable-libx264 --enable-gpl --extra-cflags=-I/usr/local/x264/include --extra-ldflags=-L/usr/local/x264/lib --prefix=

本文介绍了如何在Ubuntu上安装FFmpeg,并通过配置支持MP3和H264编码。首先从源码安装libmp3lame和libx264,然后通过配置选项`--enable-libmp3lame`和`--enable-libx264`编译FFmpeg,最后解决依赖问题和设置系统变量,成功实现FFmpeg的编译和转码功能。
最低0.47元/天 解锁文章
1729

被折叠的 条评论
为什么被折叠?



