diff --git a/mods/config.js b/mods/config.js index 7404cf89..dba9fdeb 100644 --- a/mods/config.js +++ b/mods/config.js @@ -53,6 +53,12 @@ const defaultConfig = { launchToOnStartup: null, reloadHomeOnStartup: true, disabledSidebarContents: [], + disable60fps: false, + disableAV1: false, + disableVP9: false, + disableAVC: false, + disableVP8: false, + disableHEVC: false, disableChannelsOnSidebar: false, enableUpdater: true, autoFrameRate: false, diff --git a/mods/features/adblock.js b/mods/features/adblock.js index 4c3d16be..2d80eb34 100644 --- a/mods/features/adblock.js +++ b/mods/features/adblock.js @@ -38,14 +38,39 @@ JSON.parse = function () { r.paidContentOverlay = null; } - if (r?.streamingData?.adaptiveFormats && configRead('videoPreferredCodec') !== 'any') { + if (r?.streamingData?.adaptiveFormats) { + const disableAV1 = configRead('disableAV1'); + const disableVP9 = configRead('disableVP9'); + const disableAVC = configRead('disableAVC'); + const disableVP8 = configRead('disableVP8'); + const disableHEVC = configRead('disableHEVC'); + const disable60fps = configRead('disable60fps'); const preferredCodec = configRead('videoPreferredCodec'); - const hasPreferredCodec = r.streamingData.adaptiveFormats.find(format => format.mimeType.includes(preferredCodec)); - if (hasPreferredCodec) { - r.streamingData.adaptiveFormats = r.streamingData.adaptiveFormats.filter(format => { - if (format.mimeType.startsWith('audio/')) return true; - return format.mimeType.includes(preferredCodec); - }); + + r.streamingData.adaptiveFormats = r.streamingData.adaptiveFormats.filter(format => { + if (format.mimeType.startsWith('audio/')) return true; + + const lowerMime = format.mimeType.toLowerCase(); + if (disableAV1 && (lowerMime.includes('av1') || lowerMime.includes('av01'))) return false; + if (disableVP9 && (lowerMime.includes('vp9') || lowerMime.includes('vp09'))) return false; + if (disableAVC && (lowerMime.includes('avc') || lowerMime.includes('avc1'))) return false; + if (disableVP8 && (lowerMime.includes('vp8') || lowerMime.includes('vp08'))) return false; + if (disableHEVC && (lowerMime.includes('hev') || lowerMime.includes('hvc'))) return false; + + if (disable60fps && format.fps > 30) return false; + + return true; + }); + + // Preferred codec logic (if set and available) + if (preferredCodec !== 'any') { + const hasPreferredCodec = r.streamingData.adaptiveFormats.some(format => format.mimeType.includes(preferredCodec)); + if (hasPreferredCodec) { + r.streamingData.adaptiveFormats = r.streamingData.adaptiveFormats.filter(format => { + if (format.mimeType.startsWith('audio/')) return true; + return format.mimeType.includes(preferredCodec); + }); + } } } diff --git a/mods/ui/settings.js b/mods/ui/settings.js index dec9064b..866d6c81 100644 --- a/mods/ui/settings.js +++ b/mods/ui/settings.js @@ -423,6 +423,42 @@ export default function modernUI(update, parameters) { } }) }, + { + name: 'Advanced Codec Settings', + icon: 'SETTINGS', + value: null, + menuId: 'tt-advanced-codec-settings', + menuHeader: { + title: 'Advanced Codec Settings', + subtitle: 'Individually deactivate specific codecs and high frame rates', + }, + options: [ + { + name: 'Disable 60fps (High Frame Rate)', + value: 'disable60fps' + }, + { + name: 'Disable AV1', + value: 'disableAV1' + }, + { + name: 'Disable VP9', + value: 'disableVP9' + }, + { + name: 'Disable AVC (H.264)', + value: 'disableAVC' + }, + { + name: 'Disable VP8', + value: 'disableVP8' + }, + { + name: 'Disable HEVC', + value: 'disableHEVC' + } + ] + }, window.h5vcc && window.h5vcc.tizentube && window.h5vcc.tizentube.SetFrameRate ? { name: t('settings.options.videoPlayer.options.afr'), icon: 'SLOW_MOTION_VIDEO',