测试h265和h264的编码效果,h265h264编码


OS:CentOS6.4-64bit

--------编译 FFMPEG with h265--------

1.安装 hg tool

#yum install hg

2.下载 x265 source code 并 make

#hg clone https://bitbucket.org/multicoreware/x265

#cd x265/build/linux

#make

#make install

3.下载  x264 and ffmpeg source 并 make

请参考我之前的一篇博客:

使用Nginx+FFMPEG搭建HLS直播转码服务器 (http://blog.csdn.net/wutong_login/article/details/42292787)

4.编译支持h265的 FFMPEG

#PKG_CONFIG_PATH=/usr/local/lib/pkgconfig ./configure  --prefix=/opt/ffmpeg/ --enable-version3  --enable-libvpx --enable-libfaac --enable-libmp3lame  --enable-libvorbis --enable-libx264 --enable-libxvid --enable-shared --enable-gpl --enable-postproc --enable-nonfree  --enable-avfilter --enable-pthreads --enable-libx265

#make

#make install

#ldd /opt/ffmpeg/bin/ffmpeg

note: if libx265.so.40 is not found please cp it from /usr/local/lib to /usr/lib64

--------compare h265 and h264--------

1.编码264和265

从网上找一段YUV文件,或者使用FFMPEG解码一个也可以,我使用的720P的,分别编码500Kbps。

/opt/ffmpeg/bin/ffmpeg -s 1280*720 -i /home/edward/media/720-new.yuv -vcodec libx264 -b:v 2000k /home/edward/media/720-new-264.ts

/opt/ffmpeg/bin/ffmpeg -s 1280*720 -i /home/edward/media/720-new.yuv -vcodec libx265 -b:v 2000k /home/edward/media/720-new-265.ts

再解码为YUV数据:

/opt/ffmpeg/bin/ffmpeg -i /home/edward/media/720-new-264.ts /home/edward/media/720-new-264.yuv

/opt/ffmpeg/bin/ffmpeg -i /home/edward/media/720-new-265.ts /home/edward/media/720-new-265.yuv

任意找一帧进行比较:

源图:

265:

264:

我们可以看到,264编码500k的情况下,图中红框中的几个数字,基本已经看不清了。


相关内容

    暂无相关文章