1.安装编译x265所需环境
1
| sudo apt-get install mercurial cmake cmake-curses-gui build-essential yasm
|
2.下载x265源码并编译
1
2
3
4
5
6
7
| hg clone https://bitbucket.org/multicoreware/x265
cd x265
hg co 1.2
cd build/linux
./make-Makefiles.bash
make
sudo make install
|
注 这里只能使用1.2的版本,1.3和最新的都会在编译ffmpeg时出问题
如果运行x265
出现如下错误,在/lib
下添加对应的软链接即可.
1
2
| $ x265
x265: error while loading shared libraries: libx265.so.25: cannot open shared object file: No such file or directory
|
1
2
3
| cd /lib
sudo ln -s /usr/local/lib/libx265.so.25
cd -
|
后面如果遇到同样问题,解决方法相同,so
从那里得知呢? 仔细看make install
的打印信息就知道了.
3. 安装ffmpeg编译所需库
—enable-libvidstab 依赖
1
2
3
4
5
| git clone https://github.com/georgmartius/vid.stab.git
cd vid.stab
cmake .
make
sudo make install
|
—enable-libilbc 依赖
1
2
3
4
5
6
7
| git clone https://github.com/dekkers/libilbc.git
cd libilbc
mkdir build
cd build
cmake ../
make
sudo make install
|
其他的从系统库中安装即可
1
2
3
4
5
6
7
| sudo apt-get install libmarisa-dev libfaac-dev libass-dev libmp3lame-dev \
libopus-dev libtheora-dev libvorbis-dev libvpx-dev libx264-dev libsdl1.2-dev \
libxvidcore-dev libopencore-amrnb-dev libopencore-amrwb-dev libopenjpeg-dev \
libspeex-dev libvo-aacenc-dev libvo-amrwbenc-dev libwebp-dev frei0r-plugins-dev \
libgsm1-dev libopencv-dev libschroedinger-dev libcdio-paranoia-dev \
libgnutls-dev libfdk-aac-dev librtmp-dev libtwolame-dev \
libwavpack-dev libzvbi-dev
|
4.下载编译ffmpeg源码
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
| git clone git://source.ffmpeg.org/ffmpeg.git
cd ffmpeg
./configure --arch=amd64 --disable-stripping --enable-avresample \
--enable-pthreads --enable-runtime-cpudetect --prefix=/usr --enable-bzlib \
--enable-libdc1394 --enable-libfreetype --enable-frei0r --enable-gnutls \
--enable-libgsm --enable-libmp3lame --enable-librtmp --enable-libopencv \
--enable-libopenjpeg --enable-libopus --enable-libpulse --enable-libschroedinger \
--enable-libspeex --enable-libtheora --enable-vaapi --enable-vdpau \
--enable-libvorbis --enable-libvpx --enable-zlib --enable-gpl --enable-postproc \
--enable-libcdio --enable-x11grab --enable-libx264 --enable-libxvid \
--enable-libx265 --enable-libass --enable-libfdk-aac --enable-nonfree \
--enable-libvidstab --enable-libwebp --enable-fontconfig \
--enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libvo-aacenc \
--enable-libvo-amrwbenc --enable-gray --enable-version3 --enable-libtwolame \
--enable-libwavpack --enable-libilbc --enable-libzvbi --enable-avisynth
make
sudo make install
|
6.查看hevc编码器是否存在
1
| ffmpeg -codecs | grep -i hevc
|
看到如下信息表示hevc/x265
编码已经安装成功
1
| DEV.L. hevc H.265 / HEVC (High Efficiency Video Coding) (encoders: libx265 )
|
在编码器最前面有一串字符串,含义如下
1
2
3
4
5
6
7
8
9
| Codecs:
D..... = Decoding supported
.E.... = Encoding supported
..V... = Video codec
..A... = Audio codec
..S... = Subtitle codec
...I.. = Intra frame-only codec
....L. = Lossy compression
.....S = Lossless compression
|
7.参考: