Greasy Fork is available in English.
https://github.com/erkserkserks/h264ify
当前为
// ==UserScript==
// @name YouTube H.264 (h264ify)
// @name:ru YouTube H.264 (h264ify)
// @namespace https://www.youtube.com
// @version 2023.11.19.4
// @description https://github.com/erkserkserks/h264ify
// @description:ru https://github.com/erkserkserks/h264ify
// @match *://*.youtube.com/*
// @match *://*.youtube-nocookie.com/*
// @match *://*.youtubekids.com/*
// @license MIT
// @grant none
// @run-at document-start
// ==/UserScript==
// Constants for video settings
const BLOCK_HIGH_FPS = true;
const DISALLOWED_TYPES_REGEX = /webm|vp8|vp9|av01/i;
const FRAME_RATE_REGEX = /framerate=(\d+)/;
// Modify video type checker
(function() {
const mediaSource = window.MediaSource;
if (!mediaSource) return;
const originalIsTypeSupported = mediaSource.isTypeSupported.bind(mediaSource);
mediaSource.isTypeSupported = (type) => {
if (typeof type !== 'string') return false;
if (DISALLOWED_TYPES_REGEX.test(type)) return false;
const frameRateMatch = FRAME_RATE_REGEX.exec(type);
if (BLOCK_HIGH_FPS && frameRateMatch && frameRateMatch[1] > 30) {
return false;
}
return originalIsTypeSupported(type);
};
})();