Android with Direct Play and HEVC

Hey all,

I’ve noticed that HEVC seems to be quite flaky across Android when it comes to Direct Playing HEVC encoded files - I encoded a series of files at the same time with the same lib x265, and same audio streams - some of them direct stream fine, others do not.

I have 2x Fire TV (4K HEVC ones), 4k Bravia TV (Android with HEVC and 10bit Support) and an Xbox One (which as we know, has HEVC support)

Across the 3 android devices (since the Fire TV is Android based) all fail, at the same videos (perhaps this is a Profile issue for Android on Plex?) while the Xbox plays them all fine - the Android’s claim they either can’t play or have “lost connection” with the server (which they haven’t as I can just go play another file that I know works).

So, my file meta data for example;

`
Media
Duration 1:26:44
Video Profile main
Audio Profile ma
Video Frame Rate 24p
Container MKV
Aspect Ratio 2.35
Height 800
Width 1920
Bitrate 8552 kbps
Video Resolution 1080p

Part
Size 5.18 GB
Duration 1:26:44
Video Profile main
Audio Profile ma
Container MKV
File The Simpsons Movie (2007).mkv

Duration 1:26:44
Height 800
Width 1920
Bitrate 5480 kbps
Ref Frames 1
Profile main
Pixel Format yuv420p
Level 12.0
Frame Rate Mode cfr
Frame Rate 23.976 fps
Color Space bt709
Color Range tv
Chroma Subsampling 4:2:0
Bit Depth 8
Codec HEVC
Title Surround
Language English

Duration 1:26:44
Bitrate 1536 kbps
Profile ma
Bit Depth 24
Codec DCA
Sampling Rate 48000 Hz
Bitrate Mode VBR
Audio Channel Layout 5.1(side)
Channels 5.1
Title Surround
Language English

Duration 1:26:44
Bitrate 1509 kbps
Profile dts
Bit Depth 24
Codec DCA
Sampling Rate 48000 Hz
Bitrate Mode CBR
Audio Channel Layout 5.1(side)
Channels 5.1
Title Stereo
Language English

Duration 1:26:44
Profile lc
Codec AAC
Sampling Rate 48000 Hz
Channels Stereo
`

Interestingly, in Plex’s media server log it writes;

Nov 13, 2016 00:36:34.876 [0x7f53733ff700] DEBUG - We're going to try to auto-select an audio stream for account 1. Nov 13, 2016 00:36:34.877 [0x7f53733ff700] DEBUG - Selecting best audio stream for part ID 17235 (autoselect: 0 language: en) Nov 13, 2016 00:36:34.877 [0x7f53733ff700] DEBUG - Audio Stream: 38854, Subtitle Stream: -1 Nov 13, 2016 00:36:34.878 [0x7f53733ff700] DEBUG - It took 0.0 sec to serialize a list with 1 elements. Nov 13, 2016 00:36:34.881 [0x7f53733ff700] DEBUG - MDE: received PLEX_PROTOCOL_ANY from client, selected protocol hls Nov 13, 2016 00:36:34.881 [0x7f53733ff700] DEBUG - MDE: analyzing media item 17217 Nov 13, 2016 00:36:34.881 [0x7f53733ff700] DEBUG - MDE: The Simpsons Movie (2007): Direct Play is disabled Nov 13, 2016 00:36:34.881 [0x7f53733ff700] DEBUG - MDE: The Simpsons Movie (2007): media must be transcoded in order to use the hls protocol Nov 13, 2016 00:36:34.881 [0x7f53733ff700] DEBUG - MDE: The Simpsons Movie (2007): no direct play video profile exists for http/mkv/hevc Nov 13, 2016 00:36:34.881 [0x7f53733ff700] DEBUG - MDE: The Simpsons Movie (2007): no direct play video profile exists for http/mkv/hevc/dca Nov 13, 2016 00:36:34.881 [0x7f53733ff700] DEBUG - MDE: The Simpsons Movie (2007): no direct play video profile exists for http/mkv/hevc/dca Nov 13, 2016 00:36:34.881 [0x7f53733ff700] DEBUG - MDE: The Simpsons Movie (2007): no direct play video profile exists for http/mkv/hevc/aac Nov 13, 2016 00:36:34.882 [0x7f53733ff700] DEBUG - MDE: The Simpsons Movie (2007): selected media 0 / 17217

I’m not entirely sure if that is relevant but it is complaining about a lack of profile - what would be the suggested next steps? As a note, I’m not seeing this issue with h264 files that have the same DTS audio tracks.

@andrew-s said:
I’m not entirely sure if that is relevant but it is complaining about a lack of profile - what would be the suggested next steps? As a note, I’m not seeing this issue with h264 files that have the same DTS audio tracks.

Chances are your problem is the DTS audio. The FireTV devices do not support DTS audio so they the audio to be transcoded. HLS does not support HEVC in the video stream so to convert the audio the HEVC stream also needs to be converted.

The no direct play video profile means that something in file is preventing the file from direct playing and causing the transcoding you’re seeing.

To be more specific about the cause, we would need to see the full log to understand what is happening. From what I have seen when you get a ‘Lost connection to server’ type of message but are able to play other videos right away it has been something with the file causing the transcoder to fail/crash. But with the log snippet it doesn’t cover enough of the playback attempt to determine that.

@jmckee Thanks for your reply, apologies I’ve been ill and unable to respond quickly.

I’d like to make a note that the Android TV has an AMP that does support DTS and DTS-HD attached via ARC, but you’re right the Fire TV doesn’t support DTS (internally anyway).

I did an experiment, I encode all my files with an AAC stereo track - if I select that before it “fails” it does Direct Play so, it’s definitely something with the audio-transcoding that’s causing the crash - I then switched to DTS-HD 30 seconds or so in and it transcoded fine - so, I stopped it, played from beginning with DTS-HD and this time, it failed “Playback has stopped because the connection to the Plex Media Server has been lost”. When going through the logs, I came across the following bits;

Nov 17, 2016 23:42:19.730 [0x7f5375bff700] DEBUG - Request: [x.x.x.x:52828 (Allowed Network)] GET /video/:/transcode/universal/session/8407e31daed3bf5-com-plexapp-android/base/00000.ts (16 live) TLS Signed-in Nov 17, 2016 23:42:19.730 [0x7f5375bff700] DEBUG - Asked for segment 0 from session. Nov 17, 2016 23:42:19.901 [0x7f5385bff700] ERROR - [Transcoder] [mpegts @ 0x2319680] HEVC bitstream malformed, no startcode found Nov 17, 2016 23:42:19.902 [0x7f53733ff700] ERROR - [Transcoder] av_interleaved_write_frame(): Not yet implemented in FFmpeg, patches welcome Nov 17, 2016 23:42:19.905 [0x7f53543f5700] ERROR - [Transcoder] [mpegts @ 0x2319680] HEVC bitstream malformed, no startcode found Nov 17, 2016 23:42:19.909 [0x7f53733ff700] ? - [Transcoder] Error writing trailer of media-%05d.ts: Not yet implemented in FFmpeg, patches welcom Nov 17, 2016 23:42:19.910 [0x7f5384bff700] ERROR - JobManager: child process returned: 1 (Operation not permitted) Nov 17, 2016 23:42:23.301 [0x7f5385bff700] WARN - Transcode runner appears to have died.

It looks like you were right, the transcoder dies - since it can transcode when switching afterwards - is this some issue where it’s not determining the correct audio track? More than happy to provide files/logs to help resolve this.

Sounds more like the star of the file is bad so it can’t transcode initially, but the file is fine later on so switching to transcode works. Can you create a quick 30s sample file using the same parameters and see if this causes the same issue. If so, please PM me a link to that file so we can investigate.

@MovieFan.Plex Just wanted to check if there was an update to this? I PM’d the file back in November - looks like it’s still an issue. Thanks!

@andrew-s - Sorry for the late reply. I totally missed your message or that you had sent me the sample. I’m not able to reproduce the error you are getting. However, I do notice that there are 2 DTS audio tracks. The first is actually DTS-HD MA. This track could be causing the issue. Try selecting the second DTS track at the start.

Can you try again, and provide me the entire PMS log? If you can get the logs from the Android app too, that would be great.