add user setting to disable HEVC codec #904

This commit is contained in:
Charles Ewert 2023-09-04 10:30:20 -04:00
parent 95d82f589a
commit f359a7c3bf
3 changed files with 74 additions and 33 deletions

View File

@ -1181,13 +1181,32 @@
<message> <message>
<source>All files</source> <source>All files</source>
<translation>All files</translation> <translation>All files</translation>
<extracomment>User Setting - Setting titlw</extracomment> <extracomment>User Setting - Setting title</extracomment>
</message> </message>
<message> <message>
<source>Only transcoded files</source> <source>Only transcoded files</source>
<translation>Only transcoded files</translation> <translation>Only transcoded files</translation>
<extracomment>User Setting - Setting titlw</extracomment> <extracomment>User Setting - Setting title</extracomment>
</message>
<message>
<source>Compatibility</source>
<translation>Compatibility</translation>
<extracomment>User Setting - Setting title</extracomment>
</message>
<message>
<source>Attempt to prevent playback failures.</source>
<translation>Attempt to prevent playback failures.</translation>
<extracomment>User Setting - Setting description</extracomment>
</message>
<message>
<source>Disable HEVC</source>
<translation>Disable HEVC</translation>
<extracomment>User Setting - Setting title</extracomment>
</message>
<message>
<source>Disable the HEVC codec on this device. This may improve playback for some devices (ultra).</source>
<translation>Disable the HEVC codec on this device. This may improve playback for some devices (ultra).</translation>
<extracomment>User Setting - Setting description</extracomment>
</message> </message>
</context> </context>
</TS> </TS>

View File

@ -36,6 +36,19 @@
} }
] ]
}, },
{
"title": "Compatibility",
"description": "Attempt to prevent playback failures.",
"children": [
{
"title": "Disable HEVC",
"description": "Disable the HEVC codec on this device. This may improve playback for some devices (ultra).",
"settingName": "playback.compatibility.disablehevc",
"type": "bool",
"default": "false"
}
]
},
{ {
"title": "Maximum Resolution", "title": "Maximum Resolution",
"description": "Configure the maximum resolution when playing video files on this device.", "description": "Configure the maximum resolution when playing video files on this device.",

View File

@ -1,4 +1,5 @@
import "pkg:/source/utils/misc.brs" import "pkg:/source/utils/misc.brs"
import "pkg:/source/api/baserequest.brs"
'Device Capabilities for Roku. 'Device Capabilities for Roku.
'This will likely need further tweaking 'This will likely need further tweaking
@ -16,7 +17,8 @@ function getDeviceCapabilities() as object
"SupportsContentUploading": false, "SupportsContentUploading": false,
"SupportsSync": false, "SupportsSync": false,
"DeviceProfile": getDeviceProfile(), "DeviceProfile": getDeviceProfile(),
"AppStoreUrl": "https://channelstore.roku.com/details/cc5e559d08d9ec87c5f30dcebdeebc12/jellyfin" "AppStoreUrl": "https://channelstore.roku.com/details/cc5e559d08d9ec87c5f30dcebdeebc12/jellyfin",
"IconUrl": "https://github.com/jellyfin/jellyfin-web/blob/master/src/assets/img/devices/roku.svg"
} }
end function end function
@ -126,38 +128,40 @@ function getDeviceProfile() as object
end for end for
end for end for
' HEVC / h265
hevcProfiles = ["main", "main 10"]
hevcLevels = ["4.1", "5.0", "5.1"]
addHevc = false addHevc = false
for each container in profileSupport if m.global.session.user.settings["playback.compatibility.disablehevc"] = false
for each profile in hevcProfiles ' HEVC / h265
for each level in hevcLevels hevcProfiles = ["main", "main 10"]
if di.CanDecodeVideo({ Codec: "hevc", Container: container, Profile: profile, Level: level }).Result hevcLevels = ["4.1", "5.0", "5.1"]
addHevc = true for each container in profileSupport
profileSupport[container] = updateProfileArray(profileSupport[container], "hevc", profile, level) for each profile in hevcProfiles
profileSupport[container] = updateProfileArray(profileSupport[container], "h265", profile, level) for each level in hevcLevels
if container = "mp4" if di.CanDecodeVideo({ Codec: "hevc", Container: container, Profile: profile, Level: level }).Result
' check for codec string before adding it addHevc = true
if mp4VideoCodecs.Instr(0, "h265,") = -1 profileSupport[container] = updateProfileArray(profileSupport[container], "hevc", profile, level)
mp4VideoCodecs = "h265," + mp4VideoCodecs profileSupport[container] = updateProfileArray(profileSupport[container], "h265", profile, level)
end if if container = "mp4"
if mp4VideoCodecs.Instr(0, "hevc,") = -1 ' check for codec string before adding it
mp4VideoCodecs = "hevc," + mp4VideoCodecs if mp4VideoCodecs.Instr(0, "h265,") = -1
end if mp4VideoCodecs = "h265," + mp4VideoCodecs
else if container = "ts" end if
' check for codec string before adding it if mp4VideoCodecs.Instr(0, "hevc,") = -1
if tsVideoCodecs.Instr(0, "h265,") = -1 mp4VideoCodecs = "hevc," + mp4VideoCodecs
tsVideoCodecs = "h265," + tsVideoCodecs end if
end if else if container = "ts"
if tsVideoCodecs.Instr(0, "hevc,") = -1 ' check for codec string before adding it
tsVideoCodecs = "hevc," + tsVideoCodecs if tsVideoCodecs.Instr(0, "h265,") = -1
tsVideoCodecs = "h265," + tsVideoCodecs
end if
if tsVideoCodecs.Instr(0, "hevc,") = -1
tsVideoCodecs = "hevc," + tsVideoCodecs
end if
end if end if
end if end if
end if end for
end for end for
end for end for
end for end if
' VP9 ' VP9
vp9Profiles = ["profile 0", "profile 2"] vp9Profiles = ["profile 0", "profile 2"]
@ -434,7 +438,7 @@ function getDeviceProfile() as object
"BreakOnNonKeyFrames": false "BreakOnNonKeyFrames": false
} }
' always apply max res to transcoding profile ' apply max res to transcoding profile
if maxResSetting <> "off" if maxResSetting <> "off"
tsArray.Conditions = [maxVideoHeightArray, maxVideoWidthArray] tsArray.Conditions = [maxVideoHeightArray, maxVideoWidthArray]
mp4Array.Conditions = [maxVideoHeightArray, maxVideoWidthArray] mp4Array.Conditions = [maxVideoHeightArray, maxVideoWidthArray]
@ -827,8 +831,13 @@ function GetDirectPlayProfiles() as object
} }
} }
' all possible codecs ' all possible codecs
videoCodecs = ["h264", "mpeg4 avc", "vp8", "hevc", "vp9", "av1", "h263", "mpeg1"] videoCodecs = ["h264", "mpeg4 avc", "vp8", "vp9", "av1", "h263", "mpeg1"]
audioCodecs = ["mp3", "mp2", "pcm", "lpcm", "wav", "ac3", "ac4", "aiff", "wma", "flac", "alac", "aac", "opus", "dts", "wmapro", "vorbis", "eac3", "mpg123"] audioCodecs = ["mp3", "mp2", "pcm", "lpcm", "wav", "ac3", "ac4", "aiff", "wma", "flac", "alac", "aac", "opus", "dts", "wmapro", "vorbis", "eac3", "mpg123"]
if m.global.session.user.settings["playback.compatibility.disablehevc"] = false
videoCodecs.push("hevc")
end if
' check video codecs for each container ' check video codecs for each container
for each container in supportedCodecs for each container in supportedCodecs
for each videoCodec in videoCodecs for each videoCodec in videoCodecs