[Android Apps and Games] LastSilmaril:
Some more video performance quirks.

While trying to troubleshoot video issues further, I've discovered a few things things. First, the resolution limits specified under

"Settings > Network and Settings" are completely ignored for the Chromecast. Instead, appears to be output fixed at 720p. I'm not sure why this is but the logs confirm this several times over.

The second - related - issue, is about performance: it is much harder for ffmpeg to transcode a 720p60 MPEG2 stream to a 720p AVC than a 1080i30 MPEG2 stream to 720p AVC on my i5-4570S box. 1080i30->720p30 takes maybe 20-25% of CPU maximum on the Chromecast when capped to 4000kbps (see next paragraph). 720p60->720p60 by comparison hammers it -when I try to watch these streams on the Chromecast, they drop out after the first few seconds a bunch of the time (which happens to the 1080i30 streams too if I don't use the reverse proxy); I have better luck using MX Player on my phone but even this is inconsistent. Either way, the CPU gets hammered when converting 720p60 to 720p60. Reducing the resolution to 480p results in a stream of acceptable quality while avoiding issues for the CPU. The ideal solution would be to adapt stream settings based on the source's resolution, framerate, and bitrate, but if not then simply enforcing the resolution limits under "Settings > Network and Settings" when streaming to the Chromecast could go a long way.

Lastly, 1080i30->720p30 conversion takes up 40-75% of CPU when streaming to MX Player instead of the Chromecast (where CPU usage peaks at 25%). This is appears to be because I have capped the bitrate for the Chromecast at 4000kbps. When removing this cap (making it 30000kbps, say, and removing the checkmark for 'Enforce max video bitrate') I managed to push CPU up to 38% or so, while getting a much choppier picture, but it never peaks the way it does when streaming to MX Player. So - in the meantime I would suggest adding a 'Max video bitrate' field under Network and Settings, one each for Mobile and for Wifi/Eth. These would complement the Max Bitrate fields for audio, and could still be overridden for the Chromecast by the parameter under Settings -> Chromecast.

While that doesn't seem to be the totality of the difference between how Chromecast and regular video streams are handled, capping the bitrate could still go a long way toward keeping your CPU happy and keeping your stream stable for clients other than the Chromecast, IMHO. (Actually, the other Chromecast settings could also be useful for all players, like the one allowing AC3 passthrough or not forcing downmixing of multichannel audio. This could have a detrimental effect on performance for people who don't know whether their playback clients/apps can deal with AC3 - MX Player for example needs a 'custom codec' download - besides the fact that AC3 generally has a much higher bitrate, so I get why you leave this out, but it would still be nice to have this kind of granular control over encoding settings.)

---------- Post added at 04:19 PM ---------- Previous post was at 04:11 PM ----------

(I wanted this to be a separate post but obviously the board was having none of it.)

While I'm talking to you about all this stuff, bubbleguuum - I was wondering if it were possible to enable transcoding to opus or if not m4a for audio streams, instead of mp3. Most modern CPUs should be able to handle this without issue, and support for both is baked into Android and Chromecast. This would be especially useful when bandwidth limited (on mobile, say) thanks to the greater fidelity of these newer formats at lower bitrates over mp3. I understand there could be compatibility issues with some or probably even most renderers other than BubbleUPnP itself for opus, but m4a at least has pretty widespread support now.

I guess the theme here is that I like having more control over transcoding settings, mostly for performance reasons. If you're afraid of people mucking around and then complaining when things don't work, then maybe m4a or opus support can be enabled and configured via the configuration.xml file of BubbleUPnP Server, which most people are never going to touch anyway. If you'd like alpha/beta testers on this, I for one will gladly contribute my time.

Thanks again.