From e049fb9c1f0a5ebc621facc648ca70d0daf7a282 Mon Sep 17 00:00:00 2001 From: whiteowl3 <71030468+whiteowl3@users.noreply.github.com> Date: Thu, 7 Jul 2022 15:58:01 -0400 Subject: [PATCH 001/104] vp9, av1, hdr --- source/utils/deviceCapabilities.brs | 73 ++++++++++++++++++++++++++++- 1 file changed, 72 insertions(+), 1 deletion(-) diff --git a/source/utils/deviceCapabilities.brs b/source/utils/deviceCapabilities.brs index b31f69a19..0f83a5405 100644 --- a/source/utils/deviceCapabilities.brs +++ b/source/utils/deviceCapabilities.brs @@ -34,6 +34,11 @@ function getDeviceProfile() as object if di.CanDecodeVideo({ Codec: "hevc" }).Result = true tsVideoCodecs = tsVideoCodecs + ",h265,hevc" + if di.CanDecodeVideo({ Codec: "hevc", Profile: "main 10" }).Result + MAIN10 = ",main 10" + else + MAIN10 = "" + end if end if if di.CanDecodeAudio({ Codec: "ac3" }).result @@ -41,10 +46,46 @@ function getDeviceProfile() as object else tsAudioCodecs = "aac" end if + + addAv1Profile = false + if di.CanDecodeVideo({ Codec: "av1" }).result + tsVideoCodecs = tsVideoCodecs + ",av1" + addAv1Profile = true + end if + + addVp9Profile = false + if di.CanDecodeVideo({ Codec: "vp9" }).result + tsVideoCodecs = tsVideoCodecs + ",vp9" + addVp9Profile = true + end if + tsVideoCodecs = tsVideoCodecs + ",h265,hevc" + + hevcVideoRangeTypes = "SDR" + vp9VideoRangeTypes = "SDR" + av1VideoRangeTypes = "SDR" + + dp = di.GetDisplayProperties() + if dp.Hdr10 ' or dp.Hdr10Plus? + hevcVideoRangeTypes = hevcVideoRangeTypes + ",HDR10" + vp9VideoRangeTypes = vp9VideoRangeTypes + ",HDR10" + av1VideoRangeTypes = av1VideoRangeTypes + ",HDR10" + end if + if dp.HLG + hevcVideoRangeTypes = hevcVideoRangeTypes + ",HLG" + vp9VideoRangeTypes = vp9VideoRangeTypes + ",HLG" + av1VideoRangeTypes = av1VideoRangeTypes + ",HLG" + end if + if dp.DolbyVision + hevcVideoRangeTypes = hevcVideoRangeTypes + ",DOVI" + 'vp9VideoRangeTypes = vp9VideoRangeTypes + ",DOVI" no evidence that vp9 can hold DOVI + av1VideoRangeTypes = av1VideoRangeTypes + ",DOVI" + end if + + DirectPlayProfile = GetDirectPlayProfiles() - return { + deviceProfile = { "MaxStreamingBitrate": 120000000, "MaxStaticBitrate": 100000000, "MusicStreamingTranscodingBitrate": 192000, @@ -154,6 +195,36 @@ function getDeviceProfile() as object } ] } + if addAv1Profile + deviceProfile.CodecProfiles.push({ + "Type": "Video", + "Codec": "av1", + "Conditions": [ + { + "Condition": "EqualsAny", + "Property": "VideoRangeType", + "Value": av1VideoRangeTypes, + "IsRequired": false + } + ] + }) + end if + if addVp9Profile + deviceProfile.CodecProfiles.push({ + "Type": "Video", + "Codec": "vp9", + "Conditions": [ + { + "Condition": "EqualsAny", + "Property": "VideoRangeType", + "Value": vp9VideoRangeTypes, + "IsRequired": false + } + ] + }) + end if + + return deviceProfile end function From bce88287be074331d28b3354268d547d3a7bd8b1 Mon Sep 17 00:00:00 2001 From: whiteowl3 <71030468+whiteowl3@users.noreply.github.com> Date: Thu, 7 Jul 2022 16:05:58 -0400 Subject: [PATCH 002/104] add missing hevc profile block --- source/utils/deviceCapabilities.brs | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/source/utils/deviceCapabilities.brs b/source/utils/deviceCapabilities.brs index 0f83a5405..eb9197d28 100644 --- a/source/utils/deviceCapabilities.brs +++ b/source/utils/deviceCapabilities.brs @@ -174,6 +174,30 @@ function getDeviceProfile() as object "IsRequired": false } ] + }, + { + "Type": "Video", + "Codec": "hevc", + "Conditions": [ + { + "Condition": "EqualsAny", + "Property": "VideoProfile", + "Value": "main"+MAIN10, + "IsRequired": false + }, + { + "Condition": "EqualsAny", + "Property": "VideoRangeType", + "Value": hevcVideoRangeTypes, + "IsRequired": false + }, + { + "Condition": "LessThanEqual", + "Property": "VideoLevel", + "Value": "153", + "IsRequired": false + } + ] } ], "SubtitleProfiles": [ From 6de17618eb4137a7bbad6df769eb1e44a1a7d4f6 Mon Sep 17 00:00:00 2001 From: whiteowl3 <71030468+whiteowl3@users.noreply.github.com> Date: Thu, 7 Jul 2022 16:13:30 -0400 Subject: [PATCH 003/104] Update deviceCapabilities.brs --- source/utils/deviceCapabilities.brs | 57 +++++++++++++++-------------- 1 file changed, 30 insertions(+), 27 deletions(-) diff --git a/source/utils/deviceCapabilities.brs b/source/utils/deviceCapabilities.brs index eb9197d28..61cd62677 100644 --- a/source/utils/deviceCapabilities.brs +++ b/source/utils/deviceCapabilities.brs @@ -32,12 +32,13 @@ function getDeviceProfile() as object tsVideoCodecs = "h264" end if + addHevcProfile = false + MAIN10 = "" if di.CanDecodeVideo({ Codec: "hevc" }).Result = true tsVideoCodecs = tsVideoCodecs + ",h265,hevc" + addHevcProfile = true if di.CanDecodeVideo({ Codec: "hevc", Profile: "main 10" }).Result MAIN10 = ",main 10" - else - MAIN10 = "" end if end if @@ -174,30 +175,6 @@ function getDeviceProfile() as object "IsRequired": false } ] - }, - { - "Type": "Video", - "Codec": "hevc", - "Conditions": [ - { - "Condition": "EqualsAny", - "Property": "VideoProfile", - "Value": "main"+MAIN10, - "IsRequired": false - }, - { - "Condition": "EqualsAny", - "Property": "VideoRangeType", - "Value": hevcVideoRangeTypes, - "IsRequired": false - }, - { - "Condition": "LessThanEqual", - "Property": "VideoLevel", - "Value": "153", - "IsRequired": false - } - ] } ], "SubtitleProfiles": [ @@ -232,7 +209,33 @@ function getDeviceProfile() as object } ] }) - end if + end if + if addHevcProfile + deviceProfile.CodecProfiles.push({ + "Type": "Video", + "Codec": "hevc", + "Conditions": [ + { + "Condition": "EqualsAny", + "Property": "VideoProfile", + "Value": "main"+MAIN10, + "IsRequired": false + }, + { + "Condition": "EqualsAny", + "Property": "VideoRangeType", + "Value": hevcVideoRangeTypes, + "IsRequired": false + }, + { + "Condition": "LessThanEqual", + "Property": "VideoLevel", + "Value": "153", + "IsRequired": false + } + ] + }) + end if if addVp9Profile deviceProfile.CodecProfiles.push({ "Type": "Video", From 67ce600eba59cc14f2b0e737dd8c68661d87f472 Mon Sep 17 00:00:00 2001 From: whiteowl3 <71030468+whiteowl3@users.noreply.github.com> Date: Thu, 7 Jul 2022 16:23:49 -0400 Subject: [PATCH 004/104] remove duplicate line --- source/utils/deviceCapabilities.brs | 2 -- 1 file changed, 2 deletions(-) diff --git a/source/utils/deviceCapabilities.brs b/source/utils/deviceCapabilities.brs index 61cd62677..6f788db6c 100644 --- a/source/utils/deviceCapabilities.brs +++ b/source/utils/deviceCapabilities.brs @@ -60,8 +60,6 @@ function getDeviceProfile() as object addVp9Profile = true end if - tsVideoCodecs = tsVideoCodecs + ",h265,hevc" - hevcVideoRangeTypes = "SDR" vp9VideoRangeTypes = "SDR" av1VideoRangeTypes = "SDR" From f466ee9ab762c6449fda44bbbf28f313cacc5700 Mon Sep 17 00:00:00 2001 From: Neil Burrows Date: Sun, 4 Sep 2022 10:11:08 +0100 Subject: [PATCH 005/104] 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 006/104] 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 68ade68794d6a56f087afc743dda1a911a3d9585 Mon Sep 17 00:00:00 2001 From: candry7731 <83685828+candry7731@users.noreply.github.com> Date: Tue, 6 Sep 2022 23:03:06 -0500 Subject: [PATCH 007/104] Update Video.brs --- source/VideoPlayer.brs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/source/VideoPlayer.brs b/source/VideoPlayer.brs index d6bc68b3d..9d3cac3c6 100644 --- a/source/VideoPlayer.brs +++ b/source/VideoPlayer.brs @@ -47,6 +47,8 @@ sub AddVideoContent(video, mediaSourceId, audio_stream_idx = 1, subtitle_idx = - if m.videotype = "Episode" or m.videotype = "Series" video.skipIntroParams = api_API().introskipper.get(video.id) + 'print (meta.json.RunTimeTicks / 10000000) / 60 + video.runTime = (meta.json.RunTimeTicks / 10000000.0) video.content.contenttype = "episode" end if @@ -427,10 +429,10 @@ sub autoPlayNextEpisode(videoID as string, showID as string) data = getJson(resp) if data <> invalid and data.Items.Count() = 2 - ' remove finished video node - m.global.sceneManager.callFunc("popScene") ' setup new video node nextVideo = CreateVideoPlayerGroup(data.Items[1].Id, invalid, 1, false, false) + ' remove last videoplayer scene + m.global.sceneManager.callFunc("clearPreviousScene") if nextVideo <> invalid m.global.sceneManager.callFunc("pushScene", nextVideo) else From edd39732baf5b30f4bf833a30ad562e2c8d9707a Mon Sep 17 00:00:00 2001 From: candry7731 <83685828+candry7731@users.noreply.github.com> Date: Tue, 6 Sep 2022 23:04:46 -0500 Subject: [PATCH 008/104] Update JFVideo.xml --- components/JFVideo.xml | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/components/JFVideo.xml b/components/JFVideo.xml index ad1f8ccf9..8d7ad7161 100644 --- a/components/JFVideo.xml +++ b/components/JFVideo.xml @@ -23,14 +23,19 @@ +