加载中

Introduction

The HTML5 video element is the new way to display videos online.  Before it was standardised, many sites used the Flash plugin to display videos.  Several sites (most notably Youtube) now offer both Flash-based and HTML5-based video options.  HTML5 is supported in several places where Flash isn't (including Apple's iOS devices), and people often claim that HTML5 uses the battery more efficiently than Flash.  However, nobody has ever tried to test this in a lab.  This report plans to answer the following question - is HTML5 video really good for your battery?  Let's find out, with science.

If you like this report, don't forget to write a scientific article and cite it (it's how we academic chaps get compensated, instead of money).  The bibtex file is here.

介绍

HTML5的<video>元素是一种在线播放视频的新方法。在它标准化以前,大量的网站用Flash插件来播放视频。现在已有几个网站(最出名的数Youtube了)同时支持基于Flash和基于HTML5的视频播放。有几个地方(包括苹果的iOS设备)只支持HTML5,但不支持Flash,并且人们常常声称HTML5比Flash对电池的使用效率更高。但是,还没有人曾经在实验室测试过。这份报告打算回答一下问题——HTML5播放视频是不是对你的电池更有益?让我们用科学的方法找出答案吧。

如果你喜欢这份报告,不要忘记写科技论文的时候引用本文(这是我们这些学院派最想得到的,而不只是为了钱)。参考文件如下。


Test Setup

To accurately measure the battery draw of a device, you need to physically connect a sensitive probe between the device and its battery.  I did this on two devices - a tablet and a laptop.  The tablet was the YuanDao (原道) N90, which has a 1 GHz ARM Cortex A8 processor running Android 2.3.1, and the laptop was the Samsung Series 5 Chromebook, which has a 1.66GHz Intel Atom N570 processor running Chrome OS 19.

power probes


测试设置

要准确测量设备的电池图,需要在设备和电池之间物理连接一个敏感的探头。我在两台设备上这样做了,一台平板和一台笔记本。平板是原道 N90,拥有 1 GHz ARM Cortex A8 处理器,运行 Android 2.3.1,而笔记本则是三星 Series 5 Chromebook,处理器为 1.66GHz Intel Atom N570,运行 Chrome OS 19。

power probes

For each device, I disconnected the battery from the rest of the device and routed it through a 0.125Ω resistor connected in parallel to a high-sensitivity AP034 probe.  I then connected over WiFi to a test page which served the same video via Flash and HTML5.  The voltage drop on the probe was sampled 100,000 times per second and stored on a LeCroy deep memory oscilloscope.  I then transferred the traces to Matlab for analysis and pretty pictures.


Alex under test


每部设备,我断开了电池同其它部分的连接,改为通过一个 0.125Ω电阻并联连接到一个高度敏感的 AP034 探头。然后,我通过wifi连接到通过 Flash 和 HTML5 方式提供 相同视频的测试页面。探针上的电压降每秒取样100,000次,并保存到 LeCroy 深存储示波器。然后我将轨迹导入到 Matlab 进行分析和绘制漂亮的图片

Alex under test


Understanding the Results

The battery capacity of a mobile device is usually measured in milliampere-hours (mAh).  A 1000mAh battery can supply 1000 milliamperes of current for one hour, 500 milliamperes for two hours, and so on.  The graphs you're going to see below show the average current drawn by the device while it is playing the video, starting at the moment I pressed "play" and ending as soon as the movie ended.  The lower the current draw, the higher the expected battery life.

The Samsung Chromebook's battery is rated at 8100 mAh, while the N90's battery is rated at 3200mAh.

看懂结果

移动设备的电池容量常常以毫安时(mAh)来衡量。一块1000毫安时的电池可以在放电电流1000毫安的状态下供电1小时,在500毫安的放电电流下供电2小时,如此类推。下图显示的是设备播放视频的时候的“平均电流”,就是从我一按下“播放”按钮,直到播放的电影结束。所画的电流越低,电池的使用寿命越高。

三星Chromebook的电池标称值是8100mAh,原道N90的电池标称值是3200mAh。


The Results

As shown in the figures below, HTML5 video is much better for the battery than Flash.  Moving from HTML5 to Flash resulted in a 17% rise in current draw (and a corresponding reduction in battery life) on the laptop, and a 12% rise on the tablet.  In both cases the HTML5 video was smoother and had less frame skipping than its Flash counterpart.

Laptop Current Draw

Tablet Current Draw

结果

如下图所示,相较于 Flash,HTML5 视频对电池更好;在笔记本上,从 HTML5 改为 FLASH 将增加17%的电池消耗(对应电池寿命的减少),而平板上则增加了12%。两种平台上,HTML5 都比 FLASH 画质更流畅,跳帧更少。

Laptop Current Draw

Tablet Current Draw

Conclusions

If you're watching video on a battery-powered device, it's a good idea to use HTML5 whenever you can.  Specifically in the case of YouTube you can enable it here.

Also, engineering is fun.  Go study it.

Acknowledgements

A big thank you to Greg Schechter from Youtube LLC, to Andrew Scherkus from Google Seattle and to Aki Kuusela and Aki Tikkala from Google Finland for contributing the hardware and helping me put together this page.

总结

如果你在电池驱动设备上看视频,使用HTML5更好;特别当看 YouTube 时,你可以在这里开启它。

同时,工程学很有趣。值得学习。

致谢

特别感谢来自 Youtube LLC 的 Greg Schechter,和来自谷歌Seattle 的 Andrew Scherkus以及来自谷歌Finland的 Aki Kuusela 和 Aki Tikkala,他们贡献了硬件,并帮助我完成了这一页。

返回顶部
顶部