├── LICENSE ├── README.md ├── _locales ├── cs │ └── messages.json ├── en │ └── messages.json ├── ru │ └── messages.json └── uk │ └── messages.json ├── icons ├── icon128.png ├── icon16.png └── icon48.png ├── manifest.json ├── options.html ├── options.js └── src ├── content_script.js └── inject ├── inject_codec_check.js └── inject_ln.js /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2019 alextrv 4 | Copyright (c) 2015 erkserkserks 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in all 14 | copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | SOFTWARE. 23 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # About 2 | enhanced-h264ify is a fork of well-known h264ify extension for Firefox/Chrome which blocks VP8/VP9 codecs on YouTube, so that you can use H264 only. This may be useful because there are lots of devices on the market which support H264 hardware decoding and do not support VP8/VP9. 3 | 4 | This extension has new features such as manual blocking of H264, VP8, VP9, AV1, Opus, AAC codecs and 60fps video. By default it blocks everything but H264 and 60fps video. 5 | It works only on YouTube. 6 | 7 | # Installation 8 | Install for Firefox: https://addons.mozilla.org/en-US/firefox/addon/enhanced-h264ify/ 9 | 10 | Install for Chrome: https://chrome.google.com/webstore/detail/enhanced-h264ify/omkfmpieigblcllmkgbflkikinpkodlk 11 | -------------------------------------------------------------------------------- /_locales/cs/messages.json: -------------------------------------------------------------------------------- 1 | { 2 | "extensionDescription": { 3 | "message": "Choose what video and audio codecs YouTube should play for you", 4 | "description": "Extension description" 5 | }, 6 | 7 | "optionsTitle": { 8 | "message": "Možnosti enhanced-h264ify" 9 | }, 10 | 11 | "optionsBlock60fps": { 12 | "message": "Blokovat 60fps videa" 13 | }, 14 | 15 | "optionsBlockH264": { 16 | "message": "Blokovat h264 (AVC)" 17 | }, 18 | 19 | "optionsBlockVP8": { 20 | "message": "Blokovat VP8" 21 | }, 22 | 23 | "optionsBlockVP9": { 24 | "message": "Blokovat VP9" 25 | }, 26 | 27 | "optionsBlockAV1": { 28 | "message": "Blokovat AV1" 29 | }, 30 | 31 | "optionsBlockOpus": { 32 | "message": "Blokovat Opus" 33 | }, 34 | 35 | "optionsBlockMP4A": { 36 | "message": "Blokovat AAC (MP4A)" 37 | }, 38 | 39 | "optionsDisableLN": { 40 | "message": "Zakázat normalizaci hlasitosti" 41 | }, 42 | 43 | "optionsTitleVideo": { 44 | "message": "Video" 45 | }, 46 | 47 | "optionsTitleAudio": { 48 | "message": "Zvuk" 49 | } 50 | 51 | } 52 | -------------------------------------------------------------------------------- /_locales/en/messages.json: -------------------------------------------------------------------------------- 1 | { 2 | "extensionDescription": { 3 | "message": "Choose what video and audio codecs YouTube should play for you", 4 | "description": "Extension description" 5 | }, 6 | 7 | "optionsTitle": { 8 | "message": "enhanced-h264ify" 9 | }, 10 | 11 | "optionsBlock60fps": { 12 | "message": "Block 60fps video" 13 | }, 14 | 15 | "optionsBlockH264": { 16 | "message": "Block h264 (AVC)" 17 | }, 18 | 19 | "optionsBlockVP8": { 20 | "message": "Block VP8" 21 | }, 22 | 23 | "optionsBlockVP9": { 24 | "message": "Block VP9" 25 | }, 26 | 27 | "optionsBlockAV1": { 28 | "message": "Block AV1" 29 | }, 30 | 31 | "optionsBlockOpus": { 32 | "message": "Block Opus" 33 | }, 34 | 35 | "optionsBlockMP4A": { 36 | "message": "Block AAC (MP4A)" 37 | }, 38 | 39 | "optionsDisableLN": { 40 | "message": "Disable Loudness Normalization" 41 | }, 42 | 43 | "optionsTitleVideo": { 44 | "message": "Video" 45 | }, 46 | 47 | "optionsTitleAudio": { 48 | "message": "Audio" 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /_locales/ru/messages.json: -------------------------------------------------------------------------------- 1 | { 2 | "extensionDescription": { 3 | "message": "Выбирайте сами видео и аудио кодеки, которые YouTube будет вам показывать", 4 | "description": "Extension description" 5 | }, 6 | 7 | "optionsTitle": { 8 | "message": "enhanced-h264ify" 9 | }, 10 | 11 | "optionsBlock60fps": { 12 | "message": "Блокировать 60к/с видео" 13 | }, 14 | 15 | "optionsBlockH264": { 16 | "message": "Блокировать h264 (AVC)" 17 | }, 18 | 19 | "optionsBlockVP8": { 20 | "message": "Блокировать VP8" 21 | }, 22 | 23 | "optionsBlockVP9": { 24 | "message": "Блокировать VP9" 25 | }, 26 | 27 | "optionsBlockAV1": { 28 | "message": "Блокировать AV1" 29 | }, 30 | 31 | "optionsBlockOpus": { 32 | "message": "Блокировать Opus" 33 | }, 34 | 35 | "optionsBlockMP4A": { 36 | "message": "Блокировать AAC (MP4A)" 37 | }, 38 | 39 | "optionsDisableLN": { 40 | "message": "Выключить нормализацию громкости" 41 | }, 42 | 43 | "optionsTitleVideo": { 44 | "message": "Видео" 45 | }, 46 | 47 | "optionsTitleAudio": { 48 | "message": "Аудио" 49 | } 50 | 51 | } 52 | -------------------------------------------------------------------------------- /_locales/uk/messages.json: -------------------------------------------------------------------------------- 1 | { 2 | "extensionDescription": { 3 | "message": "Вибирайте самі відео та аудіо кодеки, які YouTube буде вам показувати", 4 | "description": "Extension description" 5 | }, 6 | 7 | "optionsTitle": { 8 | "message": "enhanced-h264ify" 9 | }, 10 | 11 | "optionsBlock60fps": { 12 | "message": "Блокувати 60к/с відео" 13 | }, 14 | 15 | "optionsBlockH264": { 16 | "message": "Блокувати h264 (AVC)" 17 | }, 18 | 19 | "optionsBlockVP8": { 20 | "message": "Блокувати VP8" 21 | }, 22 | 23 | "optionsBlockVP9": { 24 | "message": "Блокувати VP9" 25 | }, 26 | 27 | "optionsBlockAV1": { 28 | "message": "Блокувати AV1" 29 | }, 30 | 31 | "optionsBlockOpus": { 32 | "message": "Блокувати Opus" 33 | }, 34 | 35 | "optionsBlockMP4A": { 36 | "message": "Блокувати AAC (MP4A)" 37 | }, 38 | 39 | "optionsDisableLN": { 40 | "message": "Вимкнути нормалізацію гучності" 41 | }, 42 | 43 | "optionsTitleVideo": { 44 | "message": "Відео" 45 | }, 46 | 47 | "optionsTitleAudio": { 48 | "message": "Аудіо" 49 | } 50 | 51 | } 52 | -------------------------------------------------------------------------------- /icons/icon128.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alextrv/enhanced-h264ify/16b206e49a391c184cc356344387927ee127049f/icons/icon128.png -------------------------------------------------------------------------------- /icons/icon16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alextrv/enhanced-h264ify/16b206e49a391c184cc356344387927ee127049f/icons/icon16.png -------------------------------------------------------------------------------- /icons/icon48.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alextrv/enhanced-h264ify/16b206e49a391c184cc356344387927ee127049f/icons/icon48.png -------------------------------------------------------------------------------- /manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "enhanced-h264ify", 3 | "version": "2.2.1", 4 | "manifest_version": 3, 5 | "description": "__MSG_extensionDescription__", 6 | "homepage_url": "https://github.com/alextrv/enhanced-h264ify", 7 | "icons": { 8 | "16": "icons/icon16.png", 9 | "48": "icons/icon48.png", 10 | "128": "icons/icon128.png" 11 | }, 12 | "action": { 13 | "default_icon": { 14 | "16": "icons/icon16.png", 15 | "48": "icons/icon48.png", 16 | "128": "icons/icon128.png" 17 | }, 18 | "default_title": "enhanced-h264ify", 19 | "default_popup": "options.html" 20 | }, 21 | "content_scripts": [ 22 | { 23 | "matches": [ 24 | "*://*.youtube.com/*", 25 | "*://*.youtube-nocookie.com/*", 26 | "*://*.youtu.be/*" 27 | ], 28 | "js": [ 29 | "src/content_script.js" 30 | ], 31 | "run_at": "document_start", 32 | "all_frames": true 33 | } 34 | ], 35 | "web_accessible_resources": [ 36 | { 37 | "matches": [ 38 | "*://*.youtube.com/*", 39 | "*://*.youtube-nocookie.com/*", 40 | "*://*.youtu.be/*" 41 | ], 42 | "resources": [ 43 | "src/inject/inject_codec_check.js", 44 | "src/inject/inject_ln.js" 45 | ] 46 | } 47 | ], 48 | "default_locale": "en", 49 | "options_ui": { 50 | "page": "options.html" 51 | }, 52 | "permissions": [ "storage" ] 53 | } 54 | -------------------------------------------------------------------------------- /options.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 54 | 55 | 56 |

57 | 64 |

65 | 70 | 71 | 72 | 73 | -------------------------------------------------------------------------------- /options.js: -------------------------------------------------------------------------------- 1 | // Saves options to chrome.storage 2 | function save_options() { 3 | var block_60fps = document.getElementById('block_60fps').checked; 4 | var block_h264 = document.getElementById('block_h264').checked; 5 | var block_vp8 = document.getElementById('block_vp8').checked; 6 | var block_vp9 = document.getElementById('block_vp9').checked; 7 | var block_av1 = document.getElementById('block_av1').checked; 8 | var block_opus = document.getElementById('block_opus').checked; 9 | var block_mp4a = document.getElementById('block_mp4a').checked; 10 | // LN stands for Loudness Normalization 11 | var disable_LN = document.getElementById('disable_LN').checked; 12 | chrome.storage.local.set({ 13 | block_60fps: block_60fps, 14 | block_h264: block_h264, 15 | block_vp8: block_vp8, 16 | block_vp9: block_vp9, 17 | block_av1: block_av1, 18 | block_opus: block_opus, 19 | block_mp4a: block_mp4a, 20 | disable_LN: disable_LN 21 | }); 22 | } 23 | 24 | // Restores checkbox state using the options stored in chrome.storage. 25 | function restore_options() { 26 | // Default values 27 | chrome.storage.local.get({ 28 | block_60fps: false, 29 | block_h264: false, 30 | block_vp8: true, 31 | block_vp9: true, 32 | block_av1: true, 33 | block_opus: false, 34 | block_mp4a: false, 35 | disable_LN: false 36 | }, function(options) { 37 | document.getElementById('block_60fps').checked = options.block_60fps; 38 | document.getElementById('block_h264').checked = options.block_h264; 39 | document.getElementById('block_vp8').checked = options.block_vp8; 40 | document.getElementById('block_vp9').checked = options.block_vp9; 41 | document.getElementById('block_av1').checked = options.block_av1; 42 | document.getElementById('block_opus').checked = options.block_opus; 43 | document.getElementById('block_mp4a').checked = options.block_mp4a; 44 | document.getElementById('disable_LN').checked = options.disable_LN; 45 | }); 46 | } 47 | 48 | // Restore saved options when extension is loaded 49 | document.addEventListener('DOMContentLoaded', restore_options); 50 | 51 | // Save options when checkboxes are clicked 52 | var checkboxes = document.getElementsByClassName('checkbox'); 53 | for (var i = 0; i < checkboxes.length; i++) { 54 | checkboxes[i].addEventListener('click', save_options) 55 | } 56 | 57 | // l10n 58 | for (let element of document.querySelectorAll('[data-l10n-id]')) { 59 | element.textContent = chrome.i18n.getMessage(element.dataset.l10nId); 60 | } 61 | -------------------------------------------------------------------------------- /src/content_script.js: -------------------------------------------------------------------------------- 1 | /** 2 | * The MIT License (MIT) 3 | * 4 | * Copyright (c) 2019 alextrv 5 | * Copyright (c) 2015 erkserkserks 6 | * 7 | * Permission is hereby granted, free of charge, to any person obtaining a copy 8 | * of this software and associated documentation files (the "Software"), to deal 9 | * in the Software without restriction, including without limitation the rights 10 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | * copies of the Software, and to permit persons to whom the Software is 12 | * furnished to do so, subject to the following conditions: 13 | * 14 | * The above copyright notice and this permission notice shall be included in all 15 | * copies or substantial portions of the Software. 16 | * 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 23 | * SOFTWARE. 24 | */ 25 | 26 | // This content script runs in an isolated environment and cannot modify any 27 | // javascript variables on the youtube page. Thus, we have to inject another 28 | // script into the DOM. 29 | 30 | // Set defaults for options stored in localStorage 31 | if (localStorage['enhanced-h264ify-block_60fps'] === undefined) { 32 | localStorage['enhanced-h264ify-block_60fps'] = false; 33 | } 34 | if (localStorage['enhanced-h264ify-block_h264'] === undefined) { 35 | localStorage['enhanced-h264ify-block_h264'] = false; 36 | } 37 | if (localStorage['enhanced-h264ify-block_vp8'] === undefined) { 38 | localStorage['enhanced-h264ify-block_vp8'] = true; 39 | } 40 | if (localStorage['enhanced-h264ify-block_vp9'] === undefined) { 41 | localStorage['enhanced-h264ify-block_vp9'] = true; 42 | } 43 | if (localStorage['enhanced-h264ify-block_av1'] === undefined) { 44 | localStorage['enhanced-h264ify-block_av1'] = true; 45 | } 46 | if (localStorage['enhanced-h264ify-block_opus'] === undefined) { 47 | localStorage['enhanced-h264ify-block_opus'] = true; 48 | } 49 | if (localStorage['enhanced-h264ify-block_mp4a'] === undefined) { 50 | localStorage['enhanced-h264ify-block_mp4a'] = true; 51 | } 52 | if (localStorage['enhanced-h264ify-disable_LN'] === undefined) { 53 | localStorage['enhanced-h264ify-disable_LN'] = false; 54 | } 55 | 56 | // Cache chrome.storage.local options in localStorage. 57 | // This is needed because chrome.storage.local.get() is async and we want to 58 | // load the injection script immediately. 59 | // See https://bugs.chromium.org/p/chromium/issues/detail?id=54257 60 | chrome.storage.local.get({ 61 | // Set defaults 62 | block_60fps: false, 63 | block_h264: false, 64 | block_vp8: true, 65 | block_vp9: true, 66 | block_av1: true, 67 | block_opus: false, 68 | block_mp4a: false, 69 | disable_LN: false 70 | }, function(options) { 71 | localStorage['enhanced-h264ify-block_60fps'] = options.block_60fps; 72 | localStorage['enhanced-h264ify-block_h264'] = options.block_h264; 73 | localStorage['enhanced-h264ify-block_vp8'] = options.block_vp8; 74 | localStorage['enhanced-h264ify-block_vp9'] = options.block_vp9; 75 | localStorage['enhanced-h264ify-block_av1'] = options.block_av1; 76 | localStorage['enhanced-h264ify-block_opus'] = options.block_opus; 77 | localStorage['enhanced-h264ify-block_mp4a'] = options.block_mp4a; 78 | localStorage['enhanced-h264ify-disable_LN'] = options.disable_LN; 79 | } 80 | ); 81 | 82 | const injectScript = document.createElement('script'); 83 | // Use textContent instead of src to run inject() synchronously 84 | injectScript.src = chrome.runtime.getURL("/src/inject/inject_codec_check.js"); 85 | injectScript.onload = function() { 86 | // Remove