jellyfin / jellyfin-roku

The Official Roku Client for Jellyfin
https://jellyfin.org
GNU General Public License v2.0
449 stars 139 forks source link

Transcoding/conversion being forced, when it's not required (HDR and/or high bitrate) #1907

Closed Skin80 closed 2 weeks ago

Skin80 commented 2 months ago

Software Versions

Describe the bug

https://github.com/jellyfin/jellyfin-roku/tree/master/source/utils/deviceCapabilities.bs forces a hardcoded bitrate limit of 40Mb/s on all video files (except h.264 codecs where the hard limit is 10Mb/s).

It also forces transcode/conversion of any file that is not "SDR" (i.e. HDR/HDR+/DoVi).

Whilst understandable from Roku, as they need to support their weakest products, it makes no sense for Jellyfin to hardcode those limitations into the app.

Jellyfin already has the ability to set a maximum bitrate by the user. Why not simply allow the Roku default to be overridden by the user?

As it stands, I have HDR video files with average bitrates of over 70mps that play on my Roku device.

However, all these files are being converted to a .ts stream, causing issues with correct recording of timestamps and resumption of video playback.

How To Reproduce

  1. Playback any video file with a video bit rate over 40mbps and/or HDR/HDR+/DoVi.

Expected behavior

Direct play/streaming of valid containers and formats, without the need for transcoding or conversion.

Logs

Relevant section of log for an HDR video file.

RemoteClientBitrateLimit: 250000000, RemoteIP: "192.168.1.207", IsInLocalNetwork: True [2024-08-09 19:36:49.921 +01:00] [DBG] Profile: "Official Roku Client", Path: "/media/Seagate/Media/Video/Movies/5 - UHD/Out of Sight (1998) {imdb-tt0120780} - 2160p.mp4", isEligibleForDirectPlay: True, isEligibleForDirectStream: False [2024-08-09 19:36:49.921 +01:00] [DBG] Profile: "VideoCodecProfile", DirectPlay=false. Reason="Official Roku Client".VideoRangeType Condition: EqualsAny. ConditionValue: "SDR". IsRequired: False. Path: "/media/Seagate/Media/Video/Movies/5 - UHD/Out of Sight (1998) {imdb-tt0120780} - 2160p.mp4" [2024-08-09 19:36:49.922 +01:00] [DBG] DirectPlay Result for Profile: "Official Roku Client", Path: "/media/Seagate/Media/Video/Movies/5 - UHD/Out of Sight (1998) {imdb-tt0120780} - 2160p.mp4", PlayMethod: null, AudioStreamIndex: 1, SubtitleStreamIndex: 2, Reasons: VideoRangeTypeNotSupported [2024-08-09 19:36:49.922 +01:00] [DBG] Transcode Result for Profile: "Official Roku Client", Path: "/media/Seagate/Media/Video/Movies/5 - UHD/Out of Sight (1998) {imdb-tt0120780} - 2160p.mp4", PlayMethod: Transcode, AudioStreamIndex: 1, SubtitleStreamIndex: 2, Reasons: VideoRangeTypeNotSupported [2024-08-09 19:36:49.922 +01:00] [DBG] StreamBuilder.BuildVideoItem( Profile="Official Roku Client", Path="/media/Seagate/Media/Video/Movies/5 - UHD/Out of Sight (1998) {imdb-tt0120780} - 2160p.mp4", AudioStreamIndex=1, SubtitleStreamIndex=2 ) => ( PlayMethod=Transcode, TranscodeReason=VideoRangeTypeNotSupported ) "media:/videos/be33619c-8a7b-3842-0e61-6535b46da292/master.m3u8?MediaSourceId=be33619c8a7b38420e616535b46da292&VideoCodec=hevc,h264,h264,hevc&AudioCodec=aac&AudioStreamIndex=1&VideoBitrate=100000000&AudioBitrate=228677&AudioSampleRate=48000&MaxFramerate=24&api_key=&TranscodingMaxAudioChannels=8&RequireAvc=false&EnableAudioVbrEncoding=true&Tag=8e20dd0f8811466a4aa0aed6830adba7&SegmentContainer=ts&MinSegments=1&BreakOnNonKeyFrames=False&hevc-level=150&hevc-videobitdepth=10&hevc-profile=main10&hevc-audiochannels=2&aac-profile=lc&hevc-rangetype=SDR&aac-audiochannels=6&TranscodeReasons=VideoRangeTypeNotSupported"

Relevant section of log for an HDR video file, with an average bit rate of 41.1Mb/s

[2024-08-09 17:24:58.860 +01:00] [DBG] Profile: "Official Roku Client", Path: "/media/Seagate/Media/Video/Movies/5 - UHD/Air Force One (1997) {imdb-tt0118571} - 2160p.mp4", isEligibleForDirectPlay: True, isEligibleForDirectStream: False [2024-08-09 17:24:58.860 +01:00] [DBG] Profile: "VideoCodecProfile", DirectPlay=false. Reason="Official Roku Client".VideoRangeType Condition: EqualsAny. ConditionValue: "SDR". IsRequired: False. Path: "/media/Seagate/Media/Video/Movies/5 - UHD/Air Force One (1997) {imdb-tt0118571} - 2160p.mp4" [2024-08-09 17:24:58.860 +01:00] [DBG] Profile: "VideoCodecProfile", DirectPlay=false. Reason="Official Roku Client".VideoBitrate Condition: LessThanEqual. ConditionValue: "40000000". IsRequired: True. Path: "/media/Seagate/Media/Video/Movies/5 - UHD/Air Force One (1997) {imdb-tt0118571} - 2160p.mp4" [2024-08-09 17:24:58.861 +01:00] [DBG] DirectPlay Result for Profile: "Official Roku Client", Path: "/media/Seagate/Media/Video/Movies/5 - UHD/Air Force One (1997) {imdb-tt0118571} - 2160p.mp4", PlayMethod: null, AudioStreamIndex: 1, SubtitleStreamIndex: -2, Reasons: VideoBitrateNotSupported, VideoRangeTypeNotSupported [2024-08-09 17:24:58.862 +01:00] [DBG] Transcode Result for Profile: "Official Roku Client", Path: "/media/Seagate/Media/Video/Movies/5 - UHD/Air Force One (1997) {imdb-tt0118571} - 2160p.mp4", PlayMethod: Transcode, AudioStreamIndex: 1, SubtitleStreamIndex: -2, Reasons: VideoBitrateNotSupported, VideoRangeTypeNotSupported [2024-08-09 17:24:58.862 +01:00] [DBG] StreamBuilder.BuildVideoItem( Profile="Official Roku Client", Path="/media/Seagate/Media/Video/Movies/5 - UHD/Air Force One (1997) {imdb-tt0118571} - 2160p.mp4", AudioStreamIndex=1, SubtitleStreamIndex=-2 ) => ( PlayMethod=Transcode, TranscodeReason=VideoBitrateNotSupported, VideoRangeTypeNotSupported ) "media:/videos/540e520a-6bd1-f3e2-acac-d9dc77e30ed6/master.m3u8?MediaSourceId=540e520a6bd1f3e2acacd9dc77e30ed6&VideoCodec=hevc,h264,h264,hevc&AudioCodec=aac&AudioStreamIndex=1&SubtitleStreamIndex=-2&VideoBitrate=40000000&AudioBitrate=226796&AudioSampleRate=48000&MaxFramerate=23.976025&MaxWidth=3840&MaxHeight=2160&api_key=&SubtitleMethod=Encode&TranscodingMaxAudioChannels=8&RequireAvc=false&EnableAudioVbrEncoding=true&Tag=ef04e09a768838e1f8cbb68c40d6e6aa&SegmentContainer=ts&MinSegments=1&BreakOnNonKeyFrames=False&hevc-level=150&hevc-videobitdepth=10&hevc-profile=main10&hevc-audiochannels=2&aac-profile=lc&hevc-rangetype=SDR&aac-audiochannels=6&TranscodeReasons=VideoBitrateNotSupported,%20VideoRangeTypeNotSupported"

Screenshots

Connection Information

Local server, over HTTP

Additional context

Why aren't device profiles open? I can edit DLNA profiles, but not the profiles of devices "officially" supported by the app, why? The average user won't touch them, but making "advanced" users build their own version of the app in order to make simple profile adjustments is an odd choice.

jimdogx commented 2 months ago

Have you tried disabling the "Bitrate Limit" setting on the client? If I disable that setting, I'm able to play HDR videos (the TV shows the HDR logo at the start).

cewert commented 1 month ago

What if we automatically remove all bitrate limits if we detect the server is local? Looks like we have the data already m.global.session.server.localURL and m.global.session.server.url

edit: Jimi suggested we disable this feature by default and I agree.

jimdogx commented 1 month ago

I don't think we need to check for local vs remote server as the Bitrate limit setting can already be toggled on/off. Never heard back from @Skin80 on whether or not this worked for them.

cewert commented 2 weeks ago

The HDR file not playing was fixed by #1989 (2.1.8) and the maxbitrate has been changed to be DISABLED by default (2.2.0).

If you still think there is room for improvement please open a new issue.