Jump to content

Android client falls back to Ffmpeg software decode on HEVC Main 8-bit 4K, request an option to force Media


Recommended Posts

MartinBuhr
Posted

I moved over from Plex fairly recently and have been happy with the switch, so I want to be upfront that this post is about the one case I have found where Plex handles something better than Emby does. I am hoping it is a reasonable candidate for a client option.

Setup

- Emby Server 4.9.5.0 on a Synology DS1221+
- Emby for Android 3.5.55, AndroidXMedia3 1.8.0
- Reproduced on two devices: an R_volution PlayerPro 8K TV (Android TV module, Amlogic S905X4-K, Android 11) and an Nvidia Shield Pro (Android 11)
- Wired gigabit throughout, media on the same NAS as the server

image.thumb.png.9e69d520afd38e302af0215bc42bd598.png

Symptom

One 4K HEVC file stutters badly on playback (Nick Matzke's Beyond The Room demo). The server reports Direct Play for stream, video and audio, and the server log shows no transcoding and no errors. Response times are 1 to 3 ms throughout.

The playback info overlay shows the cause:

 

Stuttering file
Emby

Clean file
Plex
Codec HEVC Main, Level 156 HEVC Main 10, Level 153
Bit depth 8-bit, yuv420p 10-bit
Framerate 30.0003 fps 23.976 fps
Bitrate 54 Mbps 75 Mbps
Colour  BT.709 SDR BT.2020 PQ, HDR10
Renderer Ffmpeg MediaCodec

Both are Direct Play, both are TrueHD 7.1, and both were played minutes apart on the same device in the same session. Note that the file that works is the higher bitrate of the two, so this is not a delivery or bandwidth issue.

The server log confirms it from the delivery side. On the working file the client held a single range request open for 116 seconds while playing steadily. On the stuttering file the client repeatedly disconnected and reopened at new byte offsets after 131 ms, 1389 ms and 110 ms, which looks like the loader restarting rather than a slow read.

What I think is happening

My read is that Android's MediaCodec capability query is returning no capable hardware decoder for HEVC Main profile 8-bit at 4K Level 156, so the client correctly falls back to the bundled Ffmpeg software decoder. Software HEVC decode at 4K is more than these SoCs can sustain, so it stutters.

I want to be clear that I do not think the fallback logic is wrong. Respecting the platform's capability declaration is the safe behaviour, and I would rather have graceful degradation than corrupt output.

The request

Plex on both of these same devices plays this file without any stutter, which suggests the decoders can in fact handle the stream and the declared capability profile is simply conservative. Plex appears to hand it to hardware regardless.

Would it be possible to add a client-side option along the lines of "prefer hardware decoding" or "force MediaCodec", defaulting to off, that bypasses the capability check? Users who enable it would accept the risk of artefacts or failed playback on genuinely unsupported streams, and the default behaviour would be unchanged for everyone else.

HEVC Main 8-bit at 4K is admittedly an unusual encode. Nearly all my library is Main 10 and plays flawlessly. But demo clips and camera-original footage do turn up in this form, and having a way to opt into the hardware path would close the one remaining gap I have found relative to my old setup.

Happy to supply the full server log, mediainfo output for both files, or overlay screenshots if any of that is useful.

Thanks for the work on the Android TV client, it has otherwise been a clear step up for me.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...