-
-
Notifications
You must be signed in to change notification settings - Fork 410
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
HEVC level 156 always transcoding on supported devices #3380
Comments
This is odd. The only thing I can think of is that MediaCodec is reporting a lower level than is really supported, causing transcoding. But even that I can't believe is true. Level 156 is profile level 5.2, which the Shield should definitely support. Does logcat show the device profile being sent to the server? Or maybe the server logs show it. This would certainly help narrow down the problem. I'll take a look to see what could be causing this, even though I don't have a Shield to test on. |
I don't think this affects the behaviour, but @nielsvanvelzen cherry picked the first commit in that PR for v0.16.5 rather than all of them. Therefore v0.16.5 contains the initial unfixed-up version of my change. I assume this was a mistake. As I said, shouldn't affect anything, but more confusing to debug. |
Is there any chance you can run |
Nothing transcoded before last update, Does this help?
|
It wasn't intentional and I've now cherrypicked the missing commits to make sure they will be in the next 0.16 release. |
This shows that the device is self reporting a maximum of level 5.1 high tier for the Main 10 profile. This should guarantee support for all high tier and main tier streams at level 5.1 and below. Your file appears to be encoded at level 5.2 main tier which your device doesn't report to support. If you have a look at https://en.wikipedia.org/wiki/High_Efficiency_Video_Coding#Tiers_and_levels you can see that 5.2 main tier supports a bitrate of 60,000 kbit/s while 5.1 high tier supports up to 160,000 kbit/s. But as far as I know, a 5.2 encoding can support things that a 5.1 decoder can't handle. My guess is that the Shield actually supports a higher level main tier than high tier, such as 5.2 main tier and 5.1 high tier, but it's not reporting that fact. |
The shield probably has hardware decoders for up to 5.1 and software decoding for 5.2. Seems like the same issue with the Fire TV Stick 4K - 2nd Gen (2023). 5.2 now transcodes instead of relying on the built-in software decoder. The device specs even state it only goes up to 5.1 Fire TV Stick's reported capabilities:
|
I don't think this is the case because all decoders are checked for the maximum, including software decoders. From the information that @VampiricAlien provided, the software decoder on the Shield can't even handle Main 10 profile, which is what we're looking at. It supports only up to 5.1 main tier for the Main profile, while the hardware decoder supports up to 5.1 high tier for both Main and Main 10. From the information you've provided from the Fire TV Stick 4K - 2nd Gen (2023), the software decoder supports only up to 5.2 high tier for the Main profile (and not the Main 10 profile). The hardware decoder supports up to 5.1 high tier for both Main and Main 10, which is the same as the Shield. If you are also talking about a Main 10 level 5.2 main tier video stream, like @VampiricAlien is, then neither the Fire TV Stick 4K or the Shield seems to be reporting support for this. This indicates nothing in the logic of the change is broken as such, just that both devices seem to support beyond what they claim. The previous behaviour for the Android TV client was to accept any HEVC Main stream if any HEVC decoder exists (practically all devices), and HEVC Main 10 if profile level 5 main tier is supported for it. The behaviour now is base support for both Main and Main 10 on the maximum level supported by any decoder. Therefore transcoding would be expected based on given the source file and reported decoder support. |
Yeah, you are correct. I failed to notice that the software encoder was Main not Main10. Current: Without the level checks in the prior build, Main10 5.2 played without transcoding. |
Here are some solutions:
|
I don't see option 1 happening anytime soon, upgrade hardware should solved it but this might not be an option for everyone. |
v0.16.6 doesn't fix this issue, is there a workaround? |
I'm struggling to find any information about what profile levels are supported on the Shield. I can't find a source that it supports HEVC Main 10 5.2. My concern is that you can get your specific media to play back on it, but other valid 5.2 media will fail. |
Tegra X1 (CPU) supports decode of 10-bit H.265 video streams, like you I can not find any more information out about levels. Before the patch level 5.1 played without issue. |
Hang on. Your original post says that your media file is Main10 level 5.2, not level 5.1. Does 5.1 work? It definitely should. If you do still mean 5.2 as your original post states, are you sure the Shield handles all 5.2 media? Have you tried playing back a UHD/4k stream on it? Give this file a try: http://www.larmoire.info/jellyfish/media/jellyfish-200-mbps-4k-uhd-hevc-10bit.mkv Most (if not all?) streaming devices don't support HEVC level 5.2 because UHD Blu-rays are only 5.1. I can't think of many use cases right now for a streaming device to handle more than that considering the lack of content better than a UHD Blu-ray out there. In fact, HEVC level 5.2 is a very odd choice for 1080p content. |
We also host copies of the jellyfish samples if needed: https://repo.jellyfin.org/jellyfish/ |
Sorry, level 5.2. was working before the patch. Level wasn't an issue so never though much of it until now. I've updated the Level to 5.0, this won't change the fact that many will transcode now.
The 4k video file from the link: Reason for transcoding: The video's bitrate exceeds the limit (was on 120Mbit/s, now set to auto, no change) Testing 4K files
Reason for transcoding: The video's bitrate exceeds the limit. This plays in the beta app without transcoding. I always have the beta app install for testing. |
What is the bitrate in the app preferences set to? |
Was set to 120, now set to auto. 120Mbit/s is the highest, is this set by my the device or app? |
What does this mean? You've updated what to 5.0?
I think there's a 100mbit/s limit hardcoded in the client for direct played files, and 20mbit/s for transcoded streams. What I meant was to copy the file to the device, or put it on a USB stick or something, and try playing it in some local player to see if the hardware can do it. I'm pretty sure you'll find it won't play back properly, or at the very best it'll stutter badly. That's likely the reason the device doesn't advertise level 5.2.
That's a 5.0 file. We're trying to test for 5.2 support. |
@lawadr I understand we're testing support for Level 5.2, The level 150 was to show it plays in the beta app without transcode but in 0.16.6 because of the bitrate it transcodes. Possibly a new issue. The Video file played without problem in VLC (as expected) testing using device player, playback wasn't smooth in the beginning but came right in the middle. I downloaded jellyfish-160-mbps-4k-uhd-hevc-10bit.mkv and give that a try, it plays better the other file, 40Mb/s less made a little deference. It would seem like you said it's hard coded to 100Mb/s. Where do we go from here? We have tested Nvdia Shield android 11 device to find it supports up to HEVC level 5.1 and has a hard coded bitrate limited of 120mb/s. further more, the app used to play anything HEVC @ level 5.2. I do not know how. |
First off let me say that 99.99% of my HEVC media is under Main10 5.1 and I have no issues playing them back. I was only able to find two files in my library that exceeded those limits, one HEVC Main 10 5.2 and one HEVC Main 10 6.1 file. I’ve also been testing out this issue on different devices so let me limit this to my Sony X90J TV. It has a MediaTek MT5895, which supports “HEVC: 8K@60fps”. That should be at level 6.1 if I’m reading this table correctly. With the level checks in place, I get limited to 5.2 level for both HEVC Main & Main10. Meaning any level higher than 5.2 gets transcoded, 5.2 and below direct plays. Both HEVC Main & Main10 6.1 sample media files will play directly with no issues if I bypass the level checks. Dumpsys media.player comes back empty so I can’t tell what the TV is reporting as its capabilities, but it’s probably up to level 5.2 based on when transcoding begins. Even though I can play 6.1 Main and Main10 files directly. To me, the ideal solution would be to have a user-adjustable menu. With the default option of auto, which would be set to the levels checks. Then the user could override it and choose their max level, very similar to how Plex handles h264 levels. |
This would be an acceptable solution to this issue, in app setting or server setting? |
@VampiricAlien That would be an app-based solution, but that's just an idea, no one is working on it. Would you mind attaching the entire Also, you shouldn't use the auto bitrate option, stick with 120, and you'll get the best results. It's been removed as an option for the .17 release. |
2019 shield Tegra X1 unrelated, OMX.google.vorbis.decoder, the device has vorbis support but I have notice the app transcode the audio. |
@MichaelRUSF Have been testing different device that says it supports 5.2 but still trancecodes, not sure if this is any help to you
|
Describe the bug
I knew something was going on when the media was slow to play or the subtitles skipped ahead.
Reason for transcoding: The video codec's level is not supported
I think this #3281 has effected HEVC support on devices that once supported it.
Codec: HEVC
Profile: Main 10
Level: 156
Resolution: 1920x1080
Aspect ratio: 16:9
@lawadr @nielsvanvelzen pinging both of you because the pull request has effected playback.
Logs
Stream mapping:
Stream #0:0 -> #0:0 (hevc (native) -> h264 (libx264))
Stream #0:1 -> #0:1 (copy)
Press [q] to stop, [?] for help
[libx264 @ 0x563eef26b080] using SAR=1/1
[libx264 @ 0x563eef26b080] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 BMI2 AVX2
[libx264 @ 0x563eef26b080] profile Main, level 4.0, 4:2:0, 8-bit
"SupportsTranscoding":true,"SupportsDirectStream":true,"SupportsDirectPlay":true
Application version
v0.16.5
Where did you install the app from?
Sideloaded APK
Device information
Shield
Android version
Android 11
Jellyfin server version
10.8.13
The text was updated successfully, but these errors were encountered: