With more and more HD content on the web, the performance requirements to play video increase. Dynamic streaming is an important way to circumvent those issues by automatically adjusting the video quality based on performance and bandwidth.
But it’s not just the performance impact of the video decoding (which is related to the video encoding settings) could slow down fullscreen playback – there are a couple of things you can do in the fullscreen mode to improve performance. This is specially important for HD playback, e.g. if you are planning to connect your computer to your 1080p television to play video, and you want perfectly smooth playback.
I wrote a blog post outlining some best practices, but here is a
This is a comparison of 3 common techniques. All of them use the fullScreenSourceRect to switch to fullscreen mode (Flash Player 9 feature).
1. Fullscreen mode with software scaled video and smoothing
In the this case the fullScreenSourceRect matches the screen resolution of the current screen, and the player scales the video with smoothing to fill the area. This is a common approach to keep the controls and UI crisp, but the slowest mode because the video scaling and the smoothing are done through the CPU. In most cases the performance is still acceptable, but it might not be ideal for high end use cases with a lot of scaling.
This mode was originally used for SD, but is less effective for HD. First the difference between the HD video size and the screen resolution might not be as significant anymore (therefore the controls won’t scale/blur too much), and also for “lean back” use cases where the display is e.g. a television, it might not be desired to have crip 1:1 pixel controls – since they are simply too small.
2. Fullscreen mode with software scaled video without smoothing
This approach uses the same technique as the first mode, but without the smoothing for the fullscreen video scaling. Although the quality will suffer (more pixelation during scaling), the performance will increase. Since it’s possible to measure the video performance during playback, you could adjust smoothing based on the current playback performance. If e.g. the framerate drops under 20 fps, you could seamlessly turn off smoothing in fullscreen.
This improves the performance, but is still not as fast as the last mode.
3. Fullscreen mode with hardware scaled and smoothed video
This is the fastest possible mode – the fullScreenSourceRect matches the video area (1:1 pixel mapping), and although the controls might appear slightly blurrier, the GPU will take care of the video scaling as well as smoothing. This is supported by Flash Player 9.
For SD content the mode has UI overlay scaling disadvantages, but for HD content the advantages to have smoother playback might outweigh the only slightly blurrier controls.
Conclusion
All modes perform relatively well for their use cases, but it’s important to know the differences and to prioritize according to the use case. Again, this is all for Flash Player 9 – you can find more details about the FP10 GPU mode here and here. The demo allows you to specify your own H.264 RTMP URL for performance tests. Enjoy!