Video and audio settings for no transcoding

Hi. Does anyone know what video and audio settings (container, codec, bit rates etc…) will result in no transcoding when played on both a Roku and a Sony Android TV? I currently use MP4 containers, with H264 4.1 and AC3 640Kbps for audio. This works fine on the Roku and everything direct plays perfectly. But this is resulting in the audio being transcoded on the Sony Android TV app. H264 for SD and HD content is the main issue right now, but the best options for H265 for 4K would be handy too.
Thanks

AC3 isn’t particularly widely supported but AAC is. Unfortunately, there are still bugs that will bite you, as I found out the hard way.

  1. In the Android app, in Settings, Advanced, Player, DirectPlay, you can set it to “Forced”. If your devices really can support DP-ing your content but Plex is erroneously detecting that they can’t, then this should get you going for playback purposes (ineffective for rectifying the same issue in the sync context, though).

  2. H.264 is good, but if you are encoding manually, try not specifying the h.264 level. IME it’s OK to set the profile on the encoder to “High” as just about any device you buy today can handle that, but Plex’ auto-detection tends to fall flat on it’s face if you are encoding things at a level higher than strictly necessary for the resolution and bit rate. So if you are encoding 480p/576p at level 4, which is perfectly legit, it may decide that it needs to transcode this down to level 3.1. This bug can be unpredictable, and seems to be affecting sync features for me, but not playback. Level is a cap on resolution/fps/bitrate, but every level can handle all lower resolutions/fps/bitrates as well, and this is where the auto-detection seems to be broken, at least for sync purposes.

  3. AC3 isn’t particularly widely supported, but AAC is. My advice would be to encode to AAC using the same number of channels and bit rate to ensure negligible audio fidelity loss. FDK AAC codec library generally produces the best results. This should work on just about anything, but for purposes of avoiding any further capability auto-detection bugs, if you only have stereo (as opposed to surround) sound system on your devices, it may be worth also merging the audio down to 2 channels instead of 5 or 6 or whatever the original source is.

I don’t know which, if any devices support H.265 / 4K yet (Chromecast Ultra not being available yet). You’ll need to check what your devices are capable of in terms of codec and bit rate. Note, however, that H.264 level 5.1 is sufficient for 4K@31fps. Chromecasts, for example, can handle up to 1080p and a bit rate of about 13Mbits in total (audio+video, IIRC). I usually cap the bandwidth on my 1080p conversions to 10Mbit for video, and whatever the original audio bit rate was. This works reasonably well, and most of the time the video stream compresses down to considerably less than 10Mbit (libx264, veryslow preset, CRF=16).

Thanks very much for all of the information. That was a great help.

Forcing Direct Play on the Android TV has indeed made the AC3 5.1 files direct play. Which is fantastic, but I can still detect a very small amount of an audio sync issue, where the sound is slightly behind the video, which is the reason why I noticed that it was transcoding the audio in the first place. I suspected that the transcoding was the cause, but it would appear not.

Interestingly, playing the exact same file from a USB drive on the Android TV plays perfectly and in sync.

Converting the audio to AAC 5.1 has made the file direct play on the Android TV via Plex, with or without forcing direct play, and its perfectly in sync too. But doing so now causes the Roku to transcode the audio (although with no sync issue), as I’ve learnt that it can only process 2 channel AAC. At the moment, I don’t have any surround sound, so converting everything to 2 channel AAC would make it direct play on all devices, but I don’t want to then have all content in this format if/when I do get a surround setup.

If only I can figure out why there would be a minor audio sync issue only on Android TV, with the Plex app, with an AC3 5.1 file, then with forced direct play enabled, all would be working perfectly.

Thanks again.

It’s likely that decoding AC3 is done in software, and consumes more CPU on the device, causing A/V sync issues due to CPU exhaustion. The reason it plays fine over USB could be down to WiFi driver also consuming more CPU than local block device access, just enough to push it over the edge.

It surprises me that Roku can’t handle 5.1, Chromecast certainly does, it just merges the channels.