Performance Issue: 2x2, 3x3 Grid Video Playback Lag on Android TV


I am currently facing a performance issue while testing my Android TV application.

When I configure a 2x2 grid layout and play local videos (approximately 1 GB each) from the device storage, the playback starts lagging on the physical TV device. The videos either stutter or do not play smoothly. However, the same configuration works smoothly on the Android TV emulator.

I would like to understand:

  • Is this limitation related to hardware video decoder capacity on Android TVs?

  • Is there a recommended approach for playing multiple high-resolution local videos simultaneously?

  • Should I downscale the videos or limit the bitrate for better performance?

  • Are there specific ExoPlayer optimizations recommended for multi-video playback on TV devices?

Any guidance on how to optimize multi-video playback performance on real Android TV hardware would be greatly appreciated.

2
Feb 27 at 9:16 AM
User AvatarChahat Gupta
#android#kotlin#android-jetpack-compose

Accepted Answer

As a general input as someone who has developed for Android TV: Most TVs have very underspecced hardware, they're usually designed to be able to run a single Video stream, only in the Video & Audio Codecs that are supported by the hardware. Attempting to do anything more than that at once (even if it's just a sync process in the Background) can bring some device out there to stutter or even crash. Even after tons of optimization, you'll always find a device that is worse than you thought possible.

So to answer your questions:

> Is this limitation related to hardware video decoder capacity on Android TVs?

Very likely. You will most certainly find lots of devices where the hardware decoder only supports a single video/audio stream instance. Also don't assume that decoding audio in software is feasible, it will certainly bring down quite a few TVs.

> Is there a recommended approach for playing multiple high-resolution local videos simultaneously?

My recommendation based on experience is to support the most devices, the only reasonable method is to pre-merge the videos.

> Should I downscale the videos or limit the bitrate for better performance?

This might resolve the issue for some devices, but I wouldn't bet on it.

> Are there specific ExoPlayer optimizations recommended for multi-video playback on TV devices?

Not that I'm aware of. The only resource I found regarding optimization is from the android docs:

> The device may not be able to decode the content fast enough if, for example, the content bitrate or resolution exceeds the device capabilities. You may need to use lower quality content to obtain good performance on such devices. > > If you're experiencing video stuttering on a device running a version of Android from Android 6.0 (API level 23) up to and including Android 11 (API level 30), particularly when playing DRM protected or high-frame-rate content, you can try enabling asynchronous buffer queueing.

User AvatarJensV
Feb 27 at 11:01 AM
2