jellyfin-android icon indicating copy to clipboard operation
jellyfin-android copied to clipboard

ExoPlayer profiles don't always work as expected - unnecessary transcoding, broken transcodes

Open Maxr1998 opened this issue 4 years ago • 36 comments

The currently shipped ExoPlayer profile doesn't properly advertise the device capabilities in some cases, e.g. HEVC seems to be transcoded sometimes although it shouldn't need to. Since I'm not very knowledgeable into the internals of Jellyfin transcoding and profiles, I'd request others to help me with getting to profile to work properly with as many devices as possible.

Maxr1998 avatar Aug 20 '20 09:08 Maxr1998

This is planned to be resolved with a new apiclient that's already integrated with ExoPlayer and handles media playback itself.

Maxr1998 avatar Sep 22 '20 08:09 Maxr1998

This is planned to be resolved with a new apiclient that's already integrated with ExoPlayer and handles media playback itself.

Is there an ETA when this new apiclient will be integrated, because the problem presits in v2.1?

misterbit-pro avatar Oct 25 '20 20:10 misterbit-pro

New apiclient will be released after the 10.7 server version (since it is not compatible with 10.6). But it will not contain playback related code from the start.

nielsvanvelzen avatar Oct 25 '20 21:10 nielsvanvelzen

@nielsvanvelzen Just wondering if there is any news on this now that Jellyfin 10.7 has finally reached stable.

ghost avatar Mar 10 '21 13:03 ghost

Working on the new apiclient, branch implementing it already exists in this repository. Hopefully beta release in 1 to 3 weeks.

nielsvanvelzen avatar Mar 10 '21 14:03 nielsvanvelzen

@Maxr1998 I think this issue is mostly fixed now right?

nielsvanvelzen avatar May 13 '21 06:05 nielsvanvelzen

I think so? We don't use/check the resolutions yet, however. The biggest problem was that Android could misreport wrong limits marking files as unsupported that ExoPlayer would play just fine.

Maxr1998 avatar May 13 '21 08:05 Maxr1998

I'm still having issues where HEVC content is transcoding on the JF android app; content that Direct Plays on the Plex android app.

binarydad avatar May 13 '21 12:05 binarydad

The biggest problem was that Android could misreport wrong limits marking files as unsupported that ExoPlayer would play just fine.

This could help with querying codec, profile and level support: https://github.com/google/ExoPlayer/blob/045048f6f54aafb0f801aa80df514027b04452b7/library/core/src/main/java/com/google/android/exoplayer2/mediacodec/MediaCodecUtil.java

Maxr1998 avatar May 13 '21 13:05 Maxr1998

jellyfin/jellyfin#6450 and jellyfin/jellyfin#6454 might be relevant here, as some of the cases might be covered in those bugs.

GodTamIt avatar Sep 23 '21 13:09 GodTamIt

This issue has gone 120 days without comment. To avoid abandoned issues, it will be closed in 21 days if there are no new comments.

If you're the original submitter of this issue, please comment confirming if this issue still affects you in the latest release or master branch, or close the issue if it has been fixed. If you're another user also affected by this bug, please comment confirming so. Either action will remove the stale label.

This bot exists to prevent issues from becoming stale and forgotten. Jellyfin is always moving forward, and bugs are often fixed as side effects of other changes. We therefore ask that bug report authors remain vigilant about their issues to ensure they are closed if fixed, or re-confirmed - perhaps with fresh logs or reproduction examples - regularly. If you have any questions you can reach us on Matrix or Social Media.

jellyfin-bot avatar Feb 24 '22 03:02 jellyfin-bot

Still an issue.

Maxr1998 avatar Feb 24 '22 20:02 Maxr1998

Video codec : mpeg-h part2/hevc Audio codec : aac Subtitle : ssa

Jellyfin Android 2.4.4 ExoPlayer showing its working using transcode mode, but after about 5s, it stopped with a black screen.

zx900930 avatar May 27 '22 13:05 zx900930

It's actual

anshibanov avatar Aug 01 '22 09:08 anshibanov

This open issue is now celebrating its 2nd anniversary. The official Jellyfin Android and iOS apps are apparently still unable to play HEVC files without transcoding (tested on multiple different up-to-date devices), although the unofficial Findroid app or the Jellyfin app on FireTV work correctly. If I disable transcoding for a user profile on the server, then HEVC files won't play at all in the official Android/iOS app.

I don't know if Findroid uses ExoPlayer as well. If it does, maybe use their settings? If they use a different player, maybe consider switching the player?

IgitBuh avatar Aug 19 '22 08:08 IgitBuh

It seems to be highly dependent on the played media and playback device, since I'm able to play 4K HEVC mkvs without issues on my Samsung and Pixel devices. It's also possible that the OS misreports the codecs supported by the device.

Maxr1998 avatar Aug 19 '22 10:08 Maxr1998

@Maxr1998 Playback of a HEVC video (4K or HD) on a Pixel 6 Pro is only possible with transcoding. Direct playback without transcoding results in an error. Please check correctly: Administration > Dashboard > Users > Click your user > Media Playback: Leave the first item checked, but uncheck everything else ("Allow audio/video playback that requires transcoding/conversion"). Now try playing a HEVC video in the official Android app. It will give you a client codec error, although it still works in Findroid on the same device and on a FireTV 4K stick.

IgitBuh avatar Aug 19 '22 10:08 IgitBuh

I did that, it still works and is explicitly direct playing. Maybe a bitrate limit is causing this? Could you take a look into the server logs to see what's causing the transcode?

Maxr1998 avatar Aug 19 '22 10:08 Maxr1998

[2022-08-19 10:58:15.200 +00:00] [INF] [155] Jellyfin.Api.Helpers.MediaInfoHelper: User policy for "admin". EnablePlaybackRemuxing: False EnableVideoPlaybackTranscoding: False EnableAudioPlaybackTranscoding: False
[2022-08-19 10:58:15.201 +00:00] [INF] [155] Jellyfin.Api.Helpers.MediaInfoHelper: StreamBuilder.BuildVideoItem( Profile="Anonymous Profile", Path="/Samples/sample_2560x1440.mkv", AudioStreamIndex=null, SubtitleStreamIndex=-1 ) => ( PlayMethod=Transcode, TranscodeReason=VideoCodecNotSupported ) "media:/videos/866089d3-da9f-8e63-cb1f-1763fe625999/stream?MediaSourceId=866089d3da9f8e63cb1f1763fe625999&api_key=<token>&SubtitleMethod=Encode&RequireAvc=false&Tag=377c67ede11033f58de4301fa483d9b6&TranscodeReasons=VideoCodecNotSupported"
[2022-08-19 10:58:15.362 +00:00] [INF] [98] Emby.Server.Implementations.Session.SessionManager: Playback stopped reported by app "Jellyfin Android" "2.4.4" playing "sample_2560x1440". Stopped at "0" ms

You can download this sample here: https://4kmedia.org/the-world-in-hdr-uhd-4k-demo/

IgitBuh avatar Aug 19 '22 11:08 IgitBuh

Thanks for the sample. Also direct plays both on my Pixel 5 and Z fold 4.

The Anonymous Profile in your logs is somewhat odd. For me, it shows

[INF] [69] Jellyfin.Api.Helpers.MediaInfoHelper: User policy for Max. EnablePlaybackRemuxing: True EnableVideoPlaybackTranscoding: True EnableAudioPlaybackTranscoding: True
[INF] [69] Jellyfin.Api.Helpers.MediaInfoHelper: RemoteClientBitrateLimit: 10000000, RemoteIp: 192.168.178.100, IsInLocalNetwork: True
[INF] [69] Jellyfin.Api.Helpers.MediaInfoHelper: StreamBuilder.BuildVideoItem( Profile=Jellyfin Android, Path=/video/videos/Samples/The World In HDR 4K Demo/The World In HDR 4K Demo.mkv, AudioStreamIndex=null, SubtitleStreamIndex=null ) => ( PlayMethod=DirectPlay, TranscodeReason=0 ) media:/videos/cb37ba7b-2cf9-6372-0d4b-39a86c2d3775/stream.mkv?<long_url>

Note the Jellyfin Android profile specifically. Which version of Jellyfin are you on? Did you enable the integrated (ExoPlayer) player in the client settings of the app?

Maxr1998 avatar Aug 19 '22 15:08 Maxr1998

Server: Jellyfin
Version: 10.8.4
Operating System: Linux
Architecture: X64

Installed it just yesterday in Docker from jellyfin/jellyfin:latest. (I'm switching over from Plex.) Android version installed also yesterday from Google Play Store.

Integrated player ("Based on ExoPlayer"): "Media cannot be played by this device" (as a line at the bottom) Web player: "Playback Error - This client isn't compatible with the media and the server isn't sending a compatible media format. [Got It]" (as a custom message)

I've noticed in your log that all your transcoding settings are set to True:

EnablePlaybackRemuxing: True EnableVideoPlaybackTranscoding: True EnableAudioPlaybackTranscoding: True

Are you really, really, 100% sure you disabled transcoding for the very same profile on your server?

Edit: I just enabled transcoding for my user again and expected the file started playing and in the log I now also see: EnablePlaybackRemuxing: True EnableVideoPlaybackTranscoding: True EnableAudioPlaybackTranscoding: True" I'm kind of convinced that you still have transcoding enabled. Please make sure you are editing the same used that you are using on your Android client and that you have definitely disabled the options I have described previously.

IgitBuh avatar Aug 19 '22 15:08 IgitBuh

I would like to add another observation: On my iOS tablet I've been using nPlayer for a very long time. I now also tried using it with Jellyfin and noticed something strange. In Jellyfin I have enabled DLNA and nPlayer found it. If I now open the movies list, the x264 files are shown with an additional line such as "MKV 4.81 GB" but the x265 files lack any additional details (if transcoding is off) or are shown just as "TS" without any size information (if transcoding is on).

I conclude that at least through DLNA the Jellyfin server sends incorrect details for x265/HEVC files. Maybe the same happens with the App as well. The app then refuses to play it because it knows nothing about the file (thus "Anonymous Profile"?), while Findroid or the Jellyfin app on FireTV just start playing it without knowing anything about the file?

Based on that, maybe that's not really an issue of the Jellyfin apps but of the server? However, the issue wouldn't be present if the apps just played the file like the other apps do.

IgitBuh avatar Aug 19 '22 16:08 IgitBuh

Server: Jellyfin
Version: 10.8.4
Operating System: Linux
Architecture: X64

Installed it just yesterday in Docker from jellyfin/jellyfin:latest. (I'm switching over from Plex.) Android version installed also yesterday from Google Play Store.

Ok, same here.

I've noticed in your log that all your transcoding settings are set to True:

EnablePlaybackRemuxing: True EnableVideoPlaybackTranscoding: True EnableAudioPlaybackTranscoding: True

Are you really, really, 100% sure you disabled transcoding for the very same profile on your server?

I know, I enabled them again after my testing. I just retried again with them off, and it worked just fine.

[INF] [302] Jellyfin.Api.Helpers.MediaInfoHelper: User policy for Max. EnablePlaybackRemuxing: False EnableVideoPlaybackTranscoding: False EnableAudioPlaybackTranscoding: False
[INF] [302] Jellyfin.Api.Helpers.MediaInfoHelper: RemoteClientBitrateLimit: 10000000, RemoteIp: 192.168.178.100, IsInLocalNetwork: True
[INF] [302] Jellyfin.Api.Helpers.MediaInfoHelper: StreamBuilder.BuildVideoItem( Profile=Jellyfin Android, Path=/video/videos/Samples/The World In HDR 4K Demo/The World In HDR 4K Demo.mkv, AudioStreamIndex=null, SubtitleStreamIndex=null ) => ( PlayMethod=DirectPlay, TranscodeReason=0 ) media:/videos/cb37ba7b-2cf9-6372-0d4b-39a86c2d3775/stream.mkv?<long_url>

The web player doesn't work for me either. (Same "This client isn't compatible with the media and the server isn't sending a compatible media format." message). This happens because the web view doesn't have the necessary codec support, that's why the integrated player is preferable and will be the default in the future (once it supports all features). This issue is only about the integrated player/ExoPlayer.

I can't comment on the topic of DLNA because I don't use it. It may be an issue with the server, yes.

Maxr1998 avatar Aug 19 '22 17:08 Maxr1998

This issue is only about the integrated player/ExoPlayer.

Yes, sure. I'm just trying to provide all details that might be relevant. Same for DLNA. I understand that it has nothing to do with with the Android app, but I believe the source of this problem might have something to do with this issue.

Even if it is some kind of server problem, I can't stress enough that it works with exactly the same server without any issues with Findroid and the Jellyfin FireTV app. (but not on the latest Pixel phone and multiple 1-3 years old Samsung devices)

So what now? Anything else I could do to analyze the problem?

IgitBuh avatar Aug 19 '22 17:08 IgitBuh

I wonder if it's a configuration issue on my or your server. Especially since we use similar devices.

Still, since it lists VideoCodecNotSupported as transcode reason, could you download AIDA64 and check if video/hevc is listed among the supported codecs? It's not impossible your devices misreport their codec support for HEVC.

Furthermore, could you please check the maximum bitrate you have set in Playback → Streaming?

I apologize for the frustration, but unfortunately, it's quite hard to debug issues like these, especially if I can't reproduce them.

We really need to get better debugging support into our app. That's definitely something I'll look into soon.

Maxr1998 avatar Aug 19 '22 18:08 Maxr1998

I'm not frustrated at all. I am mainly confused that you don't seem to have this issue.

I highly doubt that it's an issue with my device, because it's the same on my Pixel phone as on the Samsung tablet and phones. The only thing they have in common is the same Jellyfin android app.

But nevertheless, here's the AIDA64 output from my Pixel 6 Pro:

<<< Codecs >>>
c2.android.aac.decoder: audio/mp4a-latm
OMX.google.aac.decoder: audio/mp4a-latm
c2.android.aac.encoder: audio/mp4a-latm
OMX.google.aac.encoder: audio/mp4a-latm
c2.android.amrnb.decoder: audio/3gpp
OMX.google.amrnb.decoder: audio/3gpp
c2.android.amrnb.encoder: audio/3gpp
OMX.google.amrnb.encoder: audio/3gpp
c2.android.amrwb.decoder: audio/amr-wb
OMX.google.amrwb.decoder: audio/amr-wb
c2.android.amrwb.encoder: audio/amr-wb
OMX.google.amrwb.encoder: audio/amr-wb
c2.android.flac.decoder: audio/flac
OMX.google.flac.decoder: audio/flac
c2.android.flac.encoder: audio/flac
OMX.google.flac.encoder: audio/flac
c2.android.g711.alaw.decoder: audio/g711-alaw
OMX.google.g711.alaw.decoder: audio/g711-alaw
c2.android.g711.mlaw.decoder: audio/g711-mlaw
OMX.google.g711.mlaw.decoder: audio/g711-mlaw
c2.android.mp3.decoder: audio/mpeg
OMX.google.mp3.decoder: audio/mpeg
c2.android.opus.decoder: audio/opus
OMX.google.opus.decoder: audio/opus
c2.android.opus.encoder: audio/opus
c2.android.raw.decoder: audio/raw
OMX.google.raw.decoder: audio/raw
c2.android.vorbis.decoder: audio/vorbis
OMX.google.vorbis.decoder: audio/vorbis
c2.exynos.h263.decoder: video/3gpp
c2.exynos.h263.encoder: video/3gpp
c2.exynos.h264.decoder: video/avc
c2.exynos.h264.encoder: video/avc
c2.exynos.hevc.decoder: video/hevc
c2.exynos.hevc.encoder: video/hevc
c2.exynos.mpeg4.decoder: video/mp4v-es
c2.exynos.mpeg4.encoder: video/mp4v-es
c2.exynos.vp8.decoder: video/x-vnd.on2.vp8
c2.exynos.vp8.encoder: video/x-vnd.on2.vp8
c2.exynos.vp9.decoder: video/x-vnd.on2.vp9
c2.exynos.vp9.encoder: video/x-vnd.on2.vp9
c2.google.av1.decoder: video/av01
c2.android.av1.decoder: video/av01
c2.android.avc.decoder: video/avc
OMX.google.h264.decoder: video/avc
c2.android.avc.encoder: video/avc
OMX.google.h264.encoder: video/avc
c2.android.h263.decoder: video/3gpp
OMX.google.h263.decoder: video/3gpp
c2.android.h263.encoder: video/3gpp
OMX.google.h263.encoder: video/3gpp
c2.android.hevc.decoder: video/hevc
OMX.google.hevc.decoder: video/hevc
c2.android.hevc.encoder: video/hevc
c2.android.mpeg4.decoder: video/mp4v-es
OMX.google.mpeg4.decoder: video/mp4v-es
c2.android.mpeg4.encoder: video/mp4v-es
OMX.google.mpeg4.encoder: video/mp4v-es
c2.android.vp8.decoder: video/x-vnd.on2.vp8
OMX.google.vp8.decoder: video/x-vnd.on2.vp8
c2.android.vp8.encoder: video/x-vnd.on2.vp8
OMX.google.vp8.encoder: video/x-vnd.on2.vp8
c2.android.vp9.decoder: video/x-vnd.on2.vp9
OMX.google.vp9.decoder: video/x-vnd.on2.vp9
c2.android.vp9.encoder: video/x-vnd.on2.vp9
OMX.google.vp9.encoder: video/x-vnd.on2.vp9

Playback → Streaming is empty (I haven't touched it).

If you want to see certain server or client settings, just tell me and I'll provide screenshots. Please note that I have time tonight and to a limit tomorrow, but will be away for a week after that and won't be able to test or reply during that period of time.

Edit: Please take into account that the problem also exists in the official iOS app on an up-to-date iPad Pro. So based on everything we've seen so far, there is probably some issue on the server but the official Jellyfin Android and iOS apps don't seem to be able to handle it well, while other apps like Findroid or the Jellyfin FireTV app seem to ignore the issue.

IgitBuh avatar Aug 19 '22 18:08 IgitBuh

Maybe this issue is related: https://github.com/jellyfin/jellyfin/issues/8233

IgitBuh avatar Aug 19 '22 18:08 IgitBuh

Also, i think that https://github.com/jellyfin/jellyfin-docs/blob/master/general/clients/codec-support.md/ could be updated to reflect which player type does support HVEC. For me Web player (which is sadly default ) needs transcoding from H.265, while integrated player direct streams just fine.

ireun avatar Aug 19 '22 19:08 ireun

But nevertheless, here's the AIDA64 output from my Pixel 6 Pro:

<<< Codecs >>>
[...]

Thanks, those seem to be good.

Edit: Please take into account that the problem also exists in the official iOS app on an up-to-date iPad Pro. So based on everything we've seen so far, there is probably some issue on the server but the official Jellyfin Android and iOS apps don't seem to be able to handle it well, while other apps like Findroid or the Jellyfin FireTV app seem to ignore the issue.

I'm also thinking that this could be a server issue. When you sent your log output earlier, was that from using the web player or ExoPlayer? I'd need ExoPlayer to properly judge if the device profile is transmitted correctly (it tells the server which codecs and containers the device supports).

Maxr1998 avatar Aug 19 '22 23:08 Maxr1998

Also, i think that https://github.com/jellyfin/jellyfin-docs/blob/master/general/clients/codec-support.md/ could be updated to reflect which player type does support HVEC. For me Web player (which is sadly default ) needs transcoding from H.265, while integrated player direct streams just fine.

True, the Android hasn't been updated in a while. Back then, there weren't any integrated nor external players supported.

Maxr1998 avatar Aug 19 '22 23:08 Maxr1998