簡(jiǎn)介:
如果正常只編譯安裝ffmpeg 會(huì)出缺少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是一個(gè)很強(qiáng)大的音視頻處理工具, 官網(wǎng)介紹ffmpeg是:一個(gè)完整的、跨平臺(tái)的解決方案介却,可以記錄、轉(zhuǎn)換和傳輸音頻和視頻祝高。ffmpeg既可以播放視頻,也提供命令行工具來(lái)處理視頻,另外還有強(qiáng)大的視頻處理庫(kù)用于開(kāi)發(fā)戚扳,
一旦事、安裝cmake (編譯c++源碼工程的工具魁巩,編譯libx265庫(kù)用到)
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 庫(kù)(提高編解碼效率)
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 編解碼庫(kù)
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庫(kù)的頭文件在/usr/local/include
動(dòng)靜態(tài)庫(kù)在/usr/local/lib
x264.pc庫(kù)的配置文件在/usr/local/lib/pkgconfig
四、安裝 h265 編解碼庫(kù)
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í)行時(shí)會(huì)彈出界面選項(xiàng), 按'c'再按'g'鍵保存退出
3. 安裝
[root@cxm linux]# make && make install
4. 問(wèn)題
如果make時(shí)候報(bào)錯(cuò)
x265_1.9/source/common/param.cpp:55: 錯(cuò)誤:‘char* strtok_r(char, const char, char**)’先被聲明為‘extern’后又被聲明為‘static’
修改x265_1.9/source/common/param.cpp的55行, 把"static"關(guān)鍵字去掉
5. 相關(guān)文件
h265庫(kù)的頭文件在/usr/local/include
動(dòng)靜態(tài)庫(kù)在/usr/local/lib
x265.pc庫(kù)的配置文件在/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/
(這只是臨時(shí)的肾扰,如果想永久生效寫(xiě)在/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. 問(wèn)題
在configure的時(shí)候
有報(bào)錯(cuò):enabled program:
解決:是否有ffplay(沒(méi)有的話畴嘶,yum install SDL, 后再重新configure