Building ffmpeg with libx265 on CentOS 6
x265 refers to one of the latest open source video codec used for encoding videos. It is available as free software. The x265 encoder uses the latest x265 codec based on the HEVC High Efficiency Video Coding or H.265 standard. The main objective of H.265/x265 is to improve video quality by doubling the data compression ratio of the previous standard known as H.264/x264 encoding standard. Even if the actual browsers and mobile devices do not really support it yet, it's very interesting for our computers, or even to store videos on our personal clouds/NAS...
Better quality and conversion ratio than x264 ! Let's compile it with the ultimate Video and Audio manipulation tool !!
x265
cd /usr/local/src hg clone http://hg.videolan.org/x265
cd /usr/local/src/x265/build/linux ./make-Makefiles.bash make -j6 make install ldconfig
Note that I used 'make -j6' because my CPU has 6 Cores/threads, adapt that line to your number of cores.
check
ls /usr/local/lib/libx265* /usr/local/lib/libx265.a /usr/local/lib/libx265.so@ /usr/local/lib/libx265.so.41*
FFMPEG
You can refer to Installing FFMPPEG, FLVTool2 and Yamdi on CentOS 6 if you want to install other codecs and tools.
cd /usr/local/src mkdir /usr/local/src/tmp chmod 777 /usr/local/src/tmp export TMPDIR=/usr/local/src/tmp wget https://www.ffmpeg.org/releases/ffmpeg-snapshot-git.tar.bz2
tar xjf ffmpeg-snapshot-git.tar.bz2 cd ffmpeg make distclean PKG_CONFIG_PATH="/usr/local/lib/pkgconfig" ./configure --disable-static --enable-gpl --enable-version3 --enable-nonfree --enable-shared --enable-libmp3lame --enable-libx264 --enable-libx265 --enable-libfaac --enable-libvpx --enable-libvorbis --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopencore-amrnb --enable-libtheora --enable-libxvid --enable-libfdk_aac --enable-libopus make clean && make && make install make tools/qt-faststart cp tools/qt-faststart /usr/local/bin/ ldconfig
check
ffmpeg ffmpeg version N-69032-g3aaff80 Copyright (c) 2000-2015 the FFmpeg developers built on Jan 20 2015 07:48:35 with gcc 4.4.7 (GCC) 20120313 (Red Hat 4.4.7-11) configuration: --disable-static --enable-gpl --enable-version3 --enable-nonfree --enable-shared --enable-libmp3lame --enable-libx264 --enable-libx265 --enable-libfaac --enable-libvpx --enable-libvorbis --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopencore-amrnb --enable-libtheora libavutil 54. 16.100 / 54. 16.100 libavcodec 56. 20.100 / 56. 20.100 libavformat 56. 18.101 / 56. 18.101 libavdevice 56. 4.100 / 56. 4.100 libavfilter 5. 7.100 / 5. 7.100 libswscale 3. 1.101 / 3. 1.101 libswresample 1. 1.100 / 1. 1.100 libpostproc 53. 3.100 / 53. 3.100 Hyper fast Audio and Video encoder
Let's test our new toy !!
ffmpeg -y -i /path_to_my_directory/original.m2ts -strict experimental -acodec aac -ac 2 -ab 192k -vcodec libx264 -crf 18 -preset slower -f mp4 -threads 0 /path_to_my_directory/test-conversion/x264.mp4
ffmpeg -y -i /path_to_my_directory/test-conversion/original.m2ts -strict experimental -acodec aac -ac 2 -ab 192k -c:v libx265 -crf 23 -preset medium -f mp4 -threads 0 /path_to_my_directory/test-conversion/x265.mp4
x264 converted video 95MB x265 converted video 15MB