一、windows安裝:
直接下載地址:
https://ffmpeg.zeranoe.com/builds/
https://ffmpeg.zeranoe.com/builds/win64/static/ffmpeg-20160316-git-d0a9114-win64-static.7z
解壓後即可使用:
ffmpeg -i C:\ffmpeg\test.avi -b:v 640k c:\ffmpeg\output.ts
二、linux源碼安裝:
如下:
下載 源碼包:ffmpeg-2.8.6.tar.bz2
1.從網絡上下載到的源碼包,然後解壓到指目錄
假設下載目錄 /opt/soft
cd /opt/soft
解壓包:
tar -jxvf ffmpeg-2.8.6.tar.bz2
進入解壓後目錄
cd ffmpeg-2.8.6
執行
./configure --enable-shared --prefix=/usr/local/ffmpeg
提示出錯:
yasm/nasm not found or too old. Use --disable-yasm 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
[email protected] mailing list or IRC #ffmpeg on irc.freenode.net.
Include the log file "config.log" produced by configure as this will help
solve the problem.
按照提示需要安裝yasm
使用如下
yum install yasm
安裝完成後,繼續執行
./configure --enable-shared --prefix=/usr/local/ffmpeg
時間比較長,需要等待幾分鐘
然後執行下面
make
make install
時間比較長,需要等待幾分鐘
執行過程沒有報錯,則成功安裝
檢查是否安裝成功:
/usr/local/ffmpeg/bin/ffmpeg --version
報錯如下:
/usr/local/ffmpeg/bin/ffmpeg: error while loading shared libraries: libavdevice.so.56: cannot open shared object file: No such file or directory
提示庫文件找不到。
修改文件/etc/ld.so.conf 內容增加/usr/local/ffmpeg/lib/
vim /etc/ld.so.conf
include ld.so.conf.d/*.conf
/usr/local/ffmpeg/lib/
使修改生效
ldconfig
執行 /usr/local/ffmpeg/bin/ffmpeg --version
則返回
配置環境變量 path
export PATH=/usr/local/ffmpeg/bin/:$PATH
env
則在任何目錄都可以執行 ffmpeg --version
測試執行轉碼:
ffmpeg -i test.avi -b:v 640k output.ts