From f466ee9ab762c6449fda44bbbf28f313cacc5700 Mon Sep 17 00:00:00 2001 From: Neil Burrows Date: Sun, 4 Sep 2022 10:11:08 +0100 Subject: [PATCH 1/4] HEVC Direct Play override for Profile Version --- locale/en_US/translations.ts | 20 ++++++++++++++++++++ settings/settings.json | 9 ++++++++- source/VideoPlayer.brs | 8 +++++--- 3 files changed, 33 insertions(+), 4 deletions(-) diff --git a/locale/en_US/translations.ts b/locale/en_US/translations.ts index b566fe409..e74fd02dc 100644 --- a/locale/en_US/translations.ts +++ b/locale/en_US/translations.ts @@ -692,5 +692,25 @@ Play Trailer Play Trailer + + Attempt H.264 Direct Play (Profile Lvl) + Attempt H.264 Direct Play (Profile Lvl) + Settings Menu - Title for option + + + Attempt Direct Play for H.264 media with unsupported profile levels (> 4.2) before falling back to transcoding if it fails. + Attempt Direct Play for H.264 media with unsupported profile levels (> 4.2) before falling back to transcoding if it fails. + Settings Menu - Description for option + + + Attempt HECV Direct Play (Profile Lvl) + Attempt HECV Direct Play (Profile Lvl) + Settings Menu - Title for option + + + Attempt Direct Play for HEVC media with unsupported profile levels (> 5.1) before falling back to trancoding if it fails. + Attempt Direct Play for HEVC media with unsupported profile levels (> 5.1) before falling back to trancoding if it fails. + Settings Menu - Description for option + diff --git a/settings/settings.json b/settings/settings.json index 5d523aa9a..fb2854ddd 100644 --- a/settings/settings.json +++ b/settings/settings.json @@ -11,12 +11,19 @@ "default": "false" }, { - "title": "Attempt Direct Play (Profile Lvl)", + "title": "Attempt H.264 Direct Play (Profile Lvl)", "description": "Attempt Direct Play for H.264 media with unsupported profile levels (> 4.2) before falling back to transcoding if it fails.", "settingName": "playback.tryDirect.h264ProfileLevel", "type": "bool", "default": "true" }, + { + "title": "Attempt hevc Direct Play (Profile Lvl)", + "description": "Attempt Direct Play for hevc media with unsupported profile levels (> 5.1) before falling back to trancoding if it fails.", + "settingName": "playback.tryDirect.hevcProfileLevel", + "type": "bool", + "default": "true" + }, { "title": "Cinema Mode", "description": "Cinema Mode brings the theater experience straight to your living room with the ability to play custom intros before the main feature.", diff --git a/source/VideoPlayer.brs b/source/VideoPlayer.brs index d6bc68b3d..c5e6d137a 100644 --- a/source/VideoPlayer.brs +++ b/source/VideoPlayer.brs @@ -218,12 +218,14 @@ sub AddVideoContent(video, mediaSourceId, audio_stream_idx = 1, subtitle_idx = - fully_external = false - ' For h264 video, Roku spec states that it supports and Encoding level 4.1 and 4.2. + ' For h264/hevc video, Roku spec states that it supports specfic encoding levels ' The device can decode content with a Higher Encoding level but may play it back with certain ' artifacts. If the user preference is set, and the only reason the server says we need to - ' transcode is that the Envoding Level is not supported, then try to direct play but silently + ' transcode is that the Encoding Level is not supported, then try to direct play but silently ' fall back to the transcode if that fails. - if meta.live = false and get_user_setting("playback.tryDirect.h264ProfileLevel") = "true" and playbackInfo.MediaSources[0].TranscodingUrl <> invalid and forceTranscoding = false and playbackInfo.MediaSources[0].MediaStreams[0].codec = "h264" + tryDirectPlay = get_user_setting("playback.tryDirect.h264ProfileLevel") = "true" and playbackInfo.MediaSources[0].MediaStreams[0].codec = "h264" + tryDirectPlay = tryDirectPlay or (get_user_setting("playback.tryDirect.hevcProfileLevel") = "true" and playbackInfo.MediaSources[0].MediaStreams[0].codec = "hevc") + if meta.live = false and tryDirectPlay and playbackInfo.MediaSources[0].TranscodingUrl <> invalid and forceTranscoding = false transcodingReasons = getTranscodeReasons(playbackInfo.MediaSources[0].TranscodingUrl) if transcodingReasons.Count() = 1 and transcodingReasons[0] = "VideoLevelNotSupported" video.directPlaySupported = true From 0e8290c90faf96496ca1e3863b180207ff4184ea Mon Sep 17 00:00:00 2001 From: Jimi Date: Sun, 4 Sep 2022 07:03:17 -0600 Subject: [PATCH 2/4] not all videos have streams --- source/VideoPlayer.brs | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/source/VideoPlayer.brs b/source/VideoPlayer.brs index c5e6d137a..fb6d3696b 100644 --- a/source/VideoPlayer.brs +++ b/source/VideoPlayer.brs @@ -223,13 +223,15 @@ sub AddVideoContent(video, mediaSourceId, audio_stream_idx = 1, subtitle_idx = - ' artifacts. If the user preference is set, and the only reason the server says we need to ' transcode is that the Encoding Level is not supported, then try to direct play but silently ' fall back to the transcode if that fails. - tryDirectPlay = get_user_setting("playback.tryDirect.h264ProfileLevel") = "true" and playbackInfo.MediaSources[0].MediaStreams[0].codec = "h264" - tryDirectPlay = tryDirectPlay or (get_user_setting("playback.tryDirect.hevcProfileLevel") = "true" and playbackInfo.MediaSources[0].MediaStreams[0].codec = "hevc") - if meta.live = false and tryDirectPlay and playbackInfo.MediaSources[0].TranscodingUrl <> invalid and forceTranscoding = false - transcodingReasons = getTranscodeReasons(playbackInfo.MediaSources[0].TranscodingUrl) - if transcodingReasons.Count() = 1 and transcodingReasons[0] = "VideoLevelNotSupported" - video.directPlaySupported = true - video.transcodeAvailable = true + if playbackInfo.MediaSources[0].MediaStreams.Count() > 0 + tryDirectPlay = get_user_setting("playback.tryDirect.h264ProfileLevel") = "true" and playbackInfo.MediaSources[0].MediaStreams[0].codec = "h264" + tryDirectPlay = tryDirectPlay or (get_user_setting("playback.tryDirect.hevcProfileLevel") = "true" and playbackInfo.MediaSources[0].MediaStreams[0].codec = "hevc") + if tryDirectPlay and playbackInfo.MediaSources[0].TranscodingUrl <> invalid and forceTranscoding = false + transcodingReasons = getTranscodeReasons(playbackInfo.MediaSources[0].TranscodingUrl) + if transcodingReasons.Count() = 1 and transcodingReasons[0] = "VideoLevelNotSupported" + video.directPlaySupported = true + video.transcodeAvailable = true + end if end if end if From b473b3ffbe25db0ca7dbdc107d222021eec81cff Mon Sep 17 00:00:00 2001 From: Neil Burrows Date: Thu, 6 Oct 2022 09:25:03 +0100 Subject: [PATCH 3/4] Fix variable name after merge --- source/VideoPlayer.brs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/source/VideoPlayer.brs b/source/VideoPlayer.brs index 1500953a1..f10254dc0 100644 --- a/source/VideoPlayer.brs +++ b/source/VideoPlayer.brs @@ -218,11 +218,11 @@ sub AddVideoContent(video, mediaSourceId, audio_stream_idx = 1, subtitle_idx = - ' artifacts. If the user preference is set, and the only reason the server says we need to ' transcode is that the Encoding Level is not supported, then try to direct play but silently ' fall back to the transcode if that fails. - if playbackInfo.MediaSources[0].MediaStreams.Count() > 0 and meta.live = false - tryDirectPlay = get_user_setting("playback.tryDirect.h264ProfileLevel") = "true" and playbackInfo.MediaSources[0].MediaStreams[0].codec = "h264" - tryDirectPlay = tryDirectPlay or (get_user_setting("playback.tryDirect.hevcProfileLevel") = "true" and playbackInfo.MediaSources[0].MediaStreams[0].codec = "hevc") - if tryDirectPlay and playbackInfo.MediaSources[0].TranscodingUrl <> invalid and forceTranscoding = false - transcodingReasons = getTranscodeReasons(playbackInfo.MediaSources[0].TranscodingUrl) + if m.playbackInfo.MediaSources[0].MediaStreams.Count() > 0 and meta.live = false + tryDirectPlay = get_user_setting("playback.tryDirect.h264ProfileLevel") = "true" and m.playbackInfo.MediaSources[0].MediaStreams[0].codec = "h264" + tryDirectPlay = tryDirectPlay or (get_user_setting("playback.tryDirect.hevcProfileLevel") = "true" and m.playbackInfo.MediaSources[0].MediaStreams[0].codec = "hevc") + if tryDirectPlay and m.playbackInfo.MediaSources[0].TranscodingUrl <> invalid and forceTranscoding = false + transcodingReasons = getTranscodeReasons(m.playbackInfo.MediaSources[0].TranscodingUrl) if transcodingReasons.Count() = 1 and transcodingReasons[0] = "VideoLevelNotSupported" video.directPlaySupported = true video.transcodeAvailable = true From 0f24fe9512b88dc615f5256ca1b1e0c2279e7b3b Mon Sep 17 00:00:00 2001 From: Neil Burrows Date: Tue, 6 Dec 2022 08:02:48 +0000 Subject: [PATCH 4/4] Wording for UI --- locale/en_US/translations.ts | 16 ++++++++-------- settings/settings.json | 8 ++++---- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/locale/en_US/translations.ts b/locale/en_US/translations.ts index 82ca617d4..0c759ec40 100644 --- a/locale/en_US/translations.ts +++ b/locale/en_US/translations.ts @@ -712,23 +712,23 @@ Play Trailer - Attempt H.264 Direct Play (Profile Lvl) - Attempt H.264 Direct Play (Profile Lvl) + Direct Play H.264 Unsupported Profile Levels + Direct Play H.264 Unsupported Profile Levels Settings Menu - Title for option - Attempt Direct Play for H.264 media with unsupported profile levels (> 4.2) before falling back to transcoding if it fails. - Attempt Direct Play for H.264 media with unsupported profile levels (> 4.2) before falling back to transcoding if it fails. + Attempt Direct Play for H.264 media with unsupported profile levels before falling back to transcoding if it fails. + Attempt Direct Play for H.264 media with unsupported profile levels before falling back to transcoding if it fails. Settings Menu - Description for option - Attempt HECV Direct Play (Profile Lvl) - Attempt HECV Direct Play (Profile Lvl) + Direct Play HEVC Unsupported Profile Levels + Direct Play HEVC Unsupported Profile Levels Settings Menu - Title for option - Attempt Direct Play for HEVC media with unsupported profile levels (> 5.1) before falling back to trancoding if it fails. - Attempt Direct Play for HEVC media with unsupported profile levels (> 5.1) before falling back to trancoding if it fails. + Attempt Direct Play for HEVC media with unsupported profile levels before falling back to trancoding if it fails. + Attempt Direct Play for HEVC media with unsupported profile levels before falling back to trancoding if it fails. Settings Menu - Description for option Settings relating to playback and supported codec and media types. diff --git a/settings/settings.json b/settings/settings.json index b5130585f..1f07e8f77 100644 --- a/settings/settings.json +++ b/settings/settings.json @@ -18,15 +18,15 @@ "default": "true" }, { - "title": "Attempt H.264 Direct Play (Profile Lvl)", - "description": "Attempt Direct Play for H.264 media with unsupported profile levels (> 4.2) before falling back to transcoding if it fails.", + "title": "Direct Play H.264 Unsupported Profile Levels", + "description": "Attempt Direct Play for H.264 media with unsupported profile levels before falling back to transcoding if it fails.", "settingName": "playback.tryDirect.h264ProfileLevel", "type": "bool", "default": "true" }, { - "title": "Attempt hevc Direct Play (Profile Lvl)", - "description": "Attempt Direct Play for hevc media with unsupported profile levels (> 5.1) before falling back to trancoding if it fails.", + "title": "Direct Play HEVC Unsupported Profile Levels", + "description": "Attempt Direct Play for HEVC media with unsupported profile levels before falling back to trancoding if it fails.", "settingName": "playback.tryDirect.hevcProfileLevel", "type": "bool", "default": "true"