最近有一些視頻是H.265編碼方式的,市面上不少播放器都不能播放,乾脆本身動手,用ffmpeg將其轉換成h.264看看。python
因而就有了下面在ffmepg中安裝x265的過程。linux
1.安裝mercurialbash
wget http://mercurial.selenic.com/release/mercurial-2.6.1.tar.gzui
tar -zxvf mercurial-2.6.1.tar.gz 編碼
yum -y install python-devel.x86_64spa
yum -y install python-docutils 視頻
cd mercurial-2.6.1blog
make installssl
2.安裝x265get
$ hg clone https://bitbucket.org/multicoreware/x265
$ cd x265/build/linux
$ ./make-Makefiles.bash
$ make && make install
其中cmake版本要高於2.8.8
3.編譯ffmpeg
ffmpeg
./configure --prefix=/usr/local/ --enable-gpl --enable-version3 --enable-nonfree --enable-shared --enable-zlib --enable-bzlib --enable-libfaac --enable-libmp3lame --enable-libtheora --enable-libvo-aacenc --enable-libvorbis --enable-libx264 --enable-libx265 --enable-libxvid --enable-pic --enable-pthreads --enable-pic --enable-openssl --enable-libtwolame
報錯x256 not found
查看config.log文件最後一行
到x265編譯目錄x265/build/linux將x265.pc文件複製到/usr/local/lib
而後修改/etc/profile中的環境變量PKG_CONFIG_PATH
運行pkg-config --list-all 查看x265
最後編譯ffmpeg
make
make install
查看ffmpeg是否支持h.265,運行ffmpeg
看到--enbale-libx265 證實安裝h.265成功。
接下來轉碼一個h.265視頻到h.264看看效果。
ffmpeg -i h265.mkv -c:v libx264 -preset medium -c:a aac -strict experimental -f mp4 -b:a 128k outputh264.mp4
原視頻12分14秒,通過大約15分鐘,轉碼結束。
看下結果吧。