[下载代码]
- ffmpeg: git clone git://source.ffmpeg.org/ffmpeg.git
- openh264: git clone https://github.com/cisco/openh264.git
- x264: git clone http://git.videolan.org/git/x264.git
[编译 openh264]
make
sudo make install
[编译 x264]
./configure --enable-shared
make
sudo make install
[编译 ffmpeg]
./configure
--enable-shared
--enable-libopenh264
--enable-libx264
--enable-gpl
--prefix=/usr/local/ffmpeg
make
sudo make install
[配置环境]
创建 ffmpeg.conf,写入 "/usr/local/ffmpeg/lib"
sudo ldconfig
sudo ln -s /usr/local/ffmpeg/bin/ffmpeg /usr/local/bin/
sudo ln -s /usr/local/ffmpeg/bin/ffprobe /usr/local/bin/
sudo ln -s /usr/local/ffmpeg/bin/ffserver /usr/local/bin/
ffmpeg --help
[使用 ffmpeg]
使用 openh264 将 avi 视频转为 mp4 视频:
ffmpeg -y -i in.avi -vcodec libopenh264 out.mp4
[更新于2016-07-15]
如果希望编译出静态ffmpeg,且包含libx264,假设x264和ffmpeg是同级相邻目录,需要如下操作:
[静态编译libx264]
./configure --prefix=. --enable-static
make
make install
[静态编译ffmpeg]
./configure
--enable-static
--disable-shared
--enable-libx264
--enable-gpl
--enable-ffprobe
--extra-cflags=-I../x264/include
--extra-ldflags=-L../x264/lib
--extra-libs=-ldl
make
make install
最终得到ffmpeg和ffprobe。