高级视频编码器性能对比(H265、VP9、AV1)

1、背景介绍

目前在视频编解码器中,H264已经成为绝对的主流,被大部分设备、浏览器所支持。虽然有更先进的编码器推出,但是受限于推广速度和设备支持成本,一直未能成为主流。

今年公司目标是持续降本增效,现在将”屠刀“指向了视频业务的存储成本。视频文件存储主要两块指标:存储本身和CDN资源。对于历史比较旧的数据会用更低成本的存储方式备份存储。目前主要想优化存储本身的成本。对存储成本影响最大的是文件大小,而对文件大小影响最大的是视频码率,我们想要降低文件大小就要降低视频码率,但是我们想要降低码率又不太影响视频观看质量怎么办?使用更先进的编码器。

2、编解码器对比

2.1 H264(AVC)

H.264在1997年ITU的视频编码专家组提出时被称为H.264,在ITU与ISO合作研究后被称为MPEG4 Part10或H.264。

虽然上述两个组织提出了H264编码规范,但是并没有具体实现。

2.2 H265(HEVC)

主要三个实现:

  • x265:业界最好的h265(hevc)编解码库。 同样由大名鼎鼎的VLC播放器的维护组织法国videolan组织开源的libx265编解码库: https://www.videolan.org/developers/x265.html

  • openhevc:由FFmpeg维护的H265(HEVC)的编解码库,Openhevc by OpenHEVC

  • kvazaar:FFmpeg项目引用的另一款开源的H265(HEVC)解码库,注意kvazaar解码库只提供H265解码,并不提供编码。 https://github.com/ultravideo/kvazaar

2.3 VP9

VP9也是google开源的用与比拼H265(HEVC)的编解码器,除了IE9以下版本的浏览器外,现代浏览器都支持VP9视频编码,软件实现:

  • libvpx:https://www.linuxfromscratch.org/blfs/view/svn/multimedia/libvpx.html

2.4 AV1

AV1是Google VP10、Mozilla Daala以及Cisco Thor三款开源编码项目共同研发成果。AV1打破了之前编码标准中传统的二维运动矢量模型的限制,第一次引入了仿射变换运动模型,不仅可以描述平移运动,同时可以更好的表述如旋转、缩放等更加复杂的运动,有效的提升了视频编码效率。

在实际测试中,AV1比H265(HEVC)压缩率提升约27%,可以说是力压H265。是目前为止,世界上压缩性能最好的视频编解码器。再借用游戏界的话术来讲,那AV1就是“次世代”编解码器。

软件实现包含主要是FFmpeg的两个内置库:

  • dav1d:由FFmpeg和法国videolan开源组织共同维护的dav1d编解码库:https://www.videolan.org/projects/dav1d.html。跟其他videolan维护项目不同的是,dav1d编解码库不受专利版权限制。

  • librav1e:号称最快的av1解码器。实际上dav1d和librav1e编解码器性能差不多,差别不大。
    https://github.com/xiph/rav1e

3、兼容性介绍

在H264后推出的视频编解码器主要有:H265、VP9、AV1。

编解码器的普及上,编码一遍问题不大,兜底策略可以在应用中接入软编码器,主要是在浏览器中播放的兼容性上。我们先看看Chrome浏览器对解码器的支持:

  • VP8

  • VP9

  • AV1 [Only Chrome OS, Linux, macOS, and Windows at present]

  • Theora [Except on Android variants]

  • H.264 [Google Chrome only]

  • H.265 [Google Chrome only and only where supported by the underlying OS]

  • MPEG-4 [Google Chrome OS only]

H265、AV1不是所有所有场景都支持。

再看下Android平台对视频编码器的支持

H.263对 H.263 的支持在 Android 7.0 及更高版本中并非必需• 3GPP (.3gp)
• MPEG-4 (.mp4)
H.264 AVC
Baseline Profile (BP)

(Android 3.0 及更高版本)
• 3GPP (.3gp)
• MPEG-4 (.mp4) • MPEG-TS(.ts、仅限 AAC 音频、不可查找、Android 3.0 及更高版本)
H.264 AVC
Main Profile (MP)

(Android 6.0 及更高版本)
解码器为必需项,编码器为推荐项。
H.265 HEVC
(Android 5.0 及更高版本)
适用于移动设备的 Main Profile Level 3 和适用于 Android TV 的 Main Profile Level 4.1• MPEG-4 (.mp4)
MPEG-4 SP3GPP (.3gp)
VP8
(Android 4.3 及更高版本)

(Android 2.3.3 及更高版本)
只能在 Android 4.0 及更高版本中流式传输• WebM (.webm)
• Matroska(.mkv、Android 4.0 及更高版本)
VP9
(Android 4.4 及更高版本)
• WebM (.webm)
• Matroska(.mkv、Android 4.0 及更高版本)

4、性能衡量指标

我们录制设备在电视上,编码性能太差,所以方案是H264编码后,再服务端后台进行AV1或H265转码。

涉及到了转码所以性能上我们考虑几个指标:

  • 转码实时率:专门1秒视频用多长时间,消耗多少CPU;

  • 编码效率:同样码率视频效果

5、总结

本文介绍了先进的视频编码器:H265、VP9、AV1的对比及软件实现。介绍了浏览器等平台对高级视频编码器的兼容性效果,以及编码器选型所要考虑的性能指标。

6、参考

世界上最快的VP9视频解码器 As before , I was very excited when Google released VP9 – for one, because I was one of the people involved in creating it back when I worked for Google (I no longer do). How good is it, and how much better can it be? To evaluate that question, Clément Bœsch and I set out to write a VP9 decoder from scratch for FFmpeg. The goals never changed from the original ffvp8 situation (community-developed, fast, free from the beginning). We also wanted to answer new questions: how does a well-written decoder compare, speed-wise, with a well-written decoder for other codecs? TLDR (see rest of post for details): as a codec, VP9 is quite impressive – it beats x264 in many cases. However, the encoder is slow, very slow. At higher speed settings, the quality gain melts away. This seems to be similar to what people report about HEVC (using e.g. x265 as an encoder). single-threaded decoding speed of libvpx isn’t great. FFvp9 beats it by 25-50% on a variety of machines. FFvp9 is somewhat slower than ffvp8, and somewhat faster than ffh264 decoding speed (for files encoded to matching SSIM scores). Multi-threading performance in libvpx is deplorable, it gains virtually nothing from its loopfilter-mt algorithm. FFvp9 multi-threading gains nearly as much as ffh264/ffvp8 multithreading, but there’s a cap (material-, settings- and resolution-dependent, we found it to be around 3 threads in one of our clips although it’s typically higher) after which further threads don’t cause any more gain. The codec itself To start, we did some tests on the encoder itself. The direct goal here was to identify bitrates at which encodings would give matching SSIM-scores so we could do same-quality decoder performance measurements. However, as such, it also allows us to compare encoder performance in itself. We used settings very close to recommended settings forVP8,VP9andx264, optimized for SSIM as a metric. As source clips, we chose Sintel (1920×1080 CGI content, source ), a 2-minute clip from Tears of Steel (1920×800 cinematic content, source ), and a 3-minute clip from Enter the Void (1920×818 high-grain/noise content,screenshot). For each, we encoded at various bitrates and plotted effective bitrate versus SSIM . sintel_ssimtos_ssimetv_ssim You’ll notice that in most cases, VP9 can indeed beat x264, but, there’s some big caveats: VP9 encoding (using libvpx) is horrendously slow – like, 50x slower than VP8/x264 encoding. This means that encoding a 3-minute 1080p clip takes several days on a high-end machine. Higher –cpu-used=X parameters make the quality gains melt away. libvpx’ VP9 encodes miss the target bitrates by a long shot (100% off) for the ETV clip, possibly because of our use of –aq-mode=1. libvpx tends to slowly crumble at higher bitrates for hard content – again, look at the ETV clip, where x264 shows some serious mature killer instinct at the high bitrate end of things. Overall, these results are promising, although the lack-of-speed is a serious issue. Decoder performance For decoding performance measurements, we chose (Sintel)500 (VP9), 1200 (VP8) and 700 (x264) kbps (SSIM=19.8); Tears of Steel4.0 (VP9), 7.9 (VP8) and 6.3 (x264) mbps (SSIM=19.2); and Enter the Void 9.7 (VP9), 16.6 (VP8) and 10.7 (x264) mbps (SSIM=16.2). We used FFmpeg to decode each of these files, either using the built-in decoder (to compare between codecs), or using libvpx-vp9 (to compare ffvp9 versus libvpx). Decoding time was measured in seconds using “time ffmpeg -threads 1 [-c:v libvpx-vp9] -i $file -f null -v 0 -nostats – 2>&1 | grep user”, with this FFmpeg and this libvpx revision (downloaded on Feb 20th, 2014). sintel_archs tos_archsetv_archs A few notes on ffvp9 vs. libvpx-vp9 performance: ffvp9 beats libvpx consistently by 25-50%. In practice, this means that typical middle- to high-end hardware will be able to playback 4K content using ffvp9, but not using libvpx. Low-end hardware will struggle to playback even 720p content using libvpx (but do so fine using ffvp9). on Haswell, the difference is significantly smaller than on sandybridge, likely because libvpx has some AVX2 optimizations (e.g. for MC and loop filtering), whereas ffvp9 doesn’t have that yet; this means this difference might grow over time as ffvp9 gets AVX2 optimizations also. on the Atom, the differences are significantly smaller than on other systems; the reason for this is likely that we haven’t done any significant work on Atom-performance yet. Atom has unusually large latencies between GPRs and XMM registers, which means you need to take special care in ordering your instructions to prevent unnecessary halts – we haven’t done anything in that area yet (for ffvp9). Some users may find that ffvp9 is a lot slower than advertised on 32bit; this is correct, most of our SIMD only works on 64bit machines. If you have 32bit software, port it to 64bit. Can’t port it? Ditch it. Nobody owns 32bit x86 hardware anymore these days. So how does VP9 decoding performance compare to that of other codecs? There’s basically two ways to measure this: same-bitrate (e.g. a 500kbps VP8 file vs. a 500kbps VP9 file, where the VP9 file likely looks much better), or same-quality (e.g. a VP8 file with SSIM=19.2 vs. a VP9 file with SSIM=19.2, where the VP9 file likely has a much lower bitrate). We did same-quality measurements, and found: ffvp9 tends to beat ffh264 by a tiny bit (10%), except on Atom (which is likely because ffh264 has received more Atom-specific attention than ffvp9). ffvp9 tends to be quite a bit slower than ffvp8 (15%), although the massive bitrate differences in Enter the Void actually makes it win for that clip (by about 15%, except on Atom). Given that Google promised VP9 would be no more than 40% more complex than VP8, it seems they kept that promise. we did some same-bitrate comparisons, and found that x264 and ffvp9 are essentially identical in that scenario (with x264 having slightly lower SSIM scores); vp8 tends to be about 50% faster, but looks significantly worse. Multithreading One of the killer-features in FFmpeg is frame-level multithreading, which allows multiple cores to decode different video frames in parallel. Libvpx also supports multithreading. So which is better?
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

轻口味

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值