簡介:
如果正常只編譯安裝ffmpeg 會出缺少lib264 的情況
- 系統(tǒng)版本:centos7
其他軟件版本:
??ffmpeg-3.0
??cmake-3.5.0
??last_x264
??x265_1.9
?? yasm-1.3.0
相關(guān)地址:
官網(wǎng):http://ffmpeg.org/
百度云下載地址:https://pan.baidu.com/s/1wlMFUV6olcDgVM5bMG0xRQ 密碼:tcnn
??ffmpeg是一個很強(qiáng)大的音視頻處理工具, 官網(wǎng)介紹ffmpeg是:一個完整的、跨平臺的解決方案,可以記錄、轉(zhuǎn)換和傳輸音頻和視頻。ffmpeg既可以播放視頻,也提供命令行工具來處理視頻,另外還有強(qiáng)大的視頻處理庫用于開發(fā),
一、安裝cmake (編譯c++源碼工程的工具,編譯libx265庫用到)
1. 查看 cmake 版本。安裝相應(yīng)組件
[root@cxm ~]# yum install cmake* -y
[root@cxm ~]# cmake –version
如果大于3.5就不用安裝cmake
2. 解壓
[root@cxm ffmpeg]# tar -xvf cmake-3.5.0.tar.gz
[root@cxm ffmpeg]# cd cmake-3.5.0
3. 安裝
[root@cxm cmake-3.5.0]# ./configure
[root@cxm cmake-3.5.0]# make && make install
4. 查看版本
[root@cxm cmake-3.5.0]# cmake --version
cmake version 3.5.0
CMake suite maintained and supported by Kitware (kitware.com/cmake).
二、安裝 yasm 庫(提高編解碼效率)
1. 解壓
[root@cxm ~]# cd ffmpeg/
[root@cxm ffmpeg]# tar -xvf yasm-1.3.0.tar.gz
2. 安裝
[root@cxm ffmpeg]# cd yasm-1.3.0
[root@cxm yasm-1.3.0]# ./configure
[root@cxm yasm-1.3.0]# make && make install
三、安裝 h264 編解碼庫
1. 解壓(注意:解壓后文件名的變化)
[root@cxm ffmpeg]# tar -xvf last_x264.tar.bz2
2. 安裝(目錄為 x264-snapshot-20160319-2245/ )
[root@cxm ffmpeg]# cd x264-snapshot-20160319-2245/
[root@cxm x264-snapshot-20160319-2245]# ./configure --enable-shared
[root@cxm x264-snapshot-20160319-2245]# make && make install
3. 相關(guān)文件位置
h264庫的頭文件在/usr/local/include
動靜態(tài)庫在/usr/local/lib
x264.pc庫的配置文件在/usr/local/lib/pkgconfig
四、安裝 h265 編解碼庫
1. 解壓
[root@cxm ffmpeg]# tar -xvf x265_1.9.tar.gz
2. 運(yùn)行腳本
[root@cxm ffmpeg]# cd x265_1.9/build/linux/
make-Makefiles.bash multilib.sh
[root@cxm linux]# sh make-Makefiles.bash
執(zhí)行時會彈出界面選項(xiàng), 按'c'再按'g'鍵保存退出
3. 安裝
[root@cxm linux]# make && make install
4. 問題
如果make時候報錯
x265_1.9/source/common/param.cpp:55: 錯誤:‘char* strtok_r(char, const char, char**)’先被聲明為‘extern’后又被聲明為‘static’
修改x265_1.9/source/common/param.cpp的55行, 把"static"關(guān)鍵字去掉
5. 相關(guān)文件
h265庫的頭文件在/usr/local/include
動靜態(tài)庫在/usr/local/lib
x265.pc庫的配置文件在/usr/local/lib/pkgconfig
五、安裝 ffmpeg
1. 解壓
[root@cxm ffmpeg]# tar -xvf ffmpeg-3.0.tar.bz2
2. 設(shè)置環(huán)境變量
[root@cxm ffmpeg]# cd ffmpeg-3.0
[root@cxm ffmpeg-3.0]# export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig/
(這只是臨時的,如果想永久生效寫在/etc/profile內(nèi))
3. 安裝
[root@cxm ffmpeg-3.0]# ./configure --disable-debug --enable-libx264 --enable-libx265 --enable-gpl --enable-shared
[root@cxm ffmpeg-3.0]# make && make install
4 復(fù)制文件
[root@cxm ~]# cp /usr/local/lib/libx* /lib64/
[root@cxm ~]# cp /usr/local/lib/libav* /lib64/
[root@cxm ~]# cp /usr/local/lib/libsw* /lib64/
[root@cxm ~]# cp /usr/local/lib/libpostproc* /lib64/
5. 問題
在configure的時候
有報錯:enabled program:
解決:是否有ffplay(沒有的話,yum install SDL, 后再重新configure