-
-
Save WouterG/acf1e901324aed77f466626fb5d6611f to your computer and use it in GitHub Desktop.
// ==UserScript== | |
// @name YouTube Disable Normalization | |
// @namespace http://tampermonkey.net/ | |
// @version 0.1 | |
// @description Allows true 100% volume on youtube videos. | |
// @author Wouter Gerarts | |
// @match https://www.youtube.com/* | |
// @match https://youtube.com/* | |
// @grant none | |
// ==/UserScript== | |
var alwaysEnable = true; | |
(function() { | |
'use strict'; | |
function baseElement() { | |
return document.querySelector('#content'); | |
} | |
if (typeof fullVolumeButtonTaskId === 'number') { | |
console.log('clearing interval'); | |
clearInterval(fullVolumeButtonTaskId); | |
} | |
function createFullVolumeButton() { | |
var el = document.createElement('button'); | |
el.innerText = '100% Volume'; | |
el.classList.add('full-volume-addon-button'); | |
el.onclick = function() { | |
var video = baseElement().querySelector('video'); | |
video.volume = 1; | |
}; | |
return el; | |
} | |
function round (num, sig) { | |
var mult = Math.pow(10, sig); | |
return Math.round(num * mult) / mult; | |
} | |
var fullVolumeButtonTaskId = setInterval(function() { | |
if (baseElement().querySelector('video') === undefined) { | |
console.log('video element not found'); | |
return; | |
} | |
if (baseElement().querySelector('.full-volume-addon-button') != undefined) { | |
console.log('full volume addon button already found'); | |
clearInterval(fullVolumeButtonTaskId); | |
return; | |
} | |
var volumeSlider = baseElement().querySelector('.ytp-volume-slider-handle') | |
if (volumeSlider === undefined || volumeSlider === null) { | |
console.log('volumeSlider not found'); | |
return; | |
} | |
var video = baseElement().querySelector('video'); | |
var volumeSliderLeftStr = volumeSlider.style.left; | |
var volumeSliderLeft = volumeSliderLeftStr.substr(0, volumeSliderLeftStr.length - 2); | |
var volumeSliderValue = parseFloat(volumeSliderLeft) * 2.5; | |
console.log('Checking slider ' + round(volumeSliderValue / 100, 2).toString() + ' against value ' + round(video.volume, 2).toString()); | |
if (alwaysEnable || volumeSliderValue / 100 > video.volume) { | |
var videoTitleElement = baseElement().querySelector('.ytd-video-primary-info-renderer'); | |
videoTitleElement.appendChild(createFullVolumeButton()); | |
} else { | |
console.log('volume slider did not meet criteria for Full Volume button'); | |
} | |
}, 500); | |
})(); |
Weird, I'm on Firefox as well. Maybe its the extension you are using to run userscripts? I'm using Violentmonkey, might be worth a shot if you still want to use Firefox
Thanks for sharing that. I created a new blank profile and it works, so my FF profile is just broken which I've seen before.
Any chance of an update? Seems to have just broken for me..
Any chance of an update? Seems to have just broken for me..
I maintain an alternative script which I occasionally update https://gist.github.com/abec2304/2782f4fc47f9d010dfaab00f25e69c8a
Hey,
Thanks for the scripts. I just tried them, and I'm now able to hear full volume on my YouTube videos without that annoying loudness normalization.
My question is whether this only affects my own videos on my computer or if this also affects other people who watch my videos? Do they also need this script to get this effect?
Thanks.
Hey,
Thanks for the scripts. I just tried them, and I'm now able to hear full volume on my YouTube videos without that annoying loudness normalization.
My question is whether this only affects my own videos on my computer or if this also affects other people who watch my videos? Do they also need this script to get this effect?
Thanks.
It only works for you unfortunately
Hey,
Thanks for the scripts. I just tried them, and I'm now able to hear full volume on my YouTube videos without that annoying loudness normalization.
My question is whether this only affects my own videos on my computer or if this also affects other people who watch my videos? Do they also need this script to get this effect?
Thanks.It only works for you, unfortunately
Yes, I figured, but that's ok. I'm just going to notify and encourage others in my YouTube videos to use the same app and script, and so it will be up to them to get the same effect. I don't think there's really a better solution than this one, either way, in terms of dealing with this issue. There's only one 15-year-old video that managed to get a 100%/100% (0db) ratio, which makes the video sound much louder on normal volume naturally (this is most likely also one of the reasons why it's my most popular video by far), and I have no idea what I did or why it happened. Perhaps I just got lucky with a glitch or something, and I've tried soooo hard to get the same result again. Well, it doesn't get any better than this, so I'll just have to make sure others use it as well.
Anyways, thanks for the quick response.
Hey,
Thanks for the scripts. I just tried them, and I'm now able to hear full volume on my YouTube videos without that annoying loudness normalization.
My question is whether this only affects my own videos on my computer or if this also affects other people who watch my videos? Do they also need this script to get this effect?
Thanks.It only works for you, unfortunately
Yes, I figured, but that's ok. I'm just going to notify and encourage others in my YouTube videos to use the same app and script, and so it will be up to them to get the same effect. I don't think there's really a better solution than this one, either way, in terms of dealing with this issue. There's only one 15-year-old video that managed to get a 100%/100% (0db) ratio, which makes the video sound much louder on normal volume naturally (this is most likely also one of the reasons why it's my most popular video by far), and I have no idea what I did or why it happened. Perhaps I just got lucky with a glitch or something, and I've tried soooo hard to get the same result again. Well, it doesn't get any better than this, so I'll just have to make sure others use it as well.
Anyways, thanks for the quick response.
No problem!
And yep I know exactly the issue you're talking about.
It IS possible to avoid the volume limiting, and like you said, it's to do with the (perceived) dB when Youtube analyses it.
You could find the level with some trial and error, keep uploading the same video (lossless audio ideally)
and keep lowering the dB floor (content loudness) with your video editor/export settings until you achieve 100%/100% without the plugin.
(You can right click on the video, and choose Stats for Nerds, to see the Volume/Normalised data, to check how close you're getting)
(High level content creators likely aim for 100% like you)
Good luck with your audio travels! =)
Hey,
Thanks for the scripts. I just tried them, and I'm now able to hear full volume on my YouTube videos without that annoying loudness normalization.
My question is whether this only affects my own videos on my computer or if this also affects other people who watch my videos? Do they also need this script to get this effect?
Thanks.It only works for you, unfortunately
Yes, I figured, but that's ok. I'm just going to notify and encourage others in my YouTube videos to use the same app and script, and so it will be up to them to get the same effect. I don't think there's really a better solution than this one, either way, in terms of dealing with this issue. There's only one 15-year-old video that managed to get a 100%/100% (0db) ratio, which makes the video sound much louder on normal volume naturally (this is most likely also one of the reasons why it's my most popular video by far), and I have no idea what I did or why it happened. Perhaps I just got lucky with a glitch or something, and I've tried soooo hard to get the same result again. Well, it doesn't get any better than this, so I'll just have to make sure others use it as well.
Anyways, thanks for the quick response.No problem!
And yep I know exactly the issue you're talking about. It IS possible to avoid the volume limiting, and like you said, it's to do with the (perceived) dB when Youtube analyses it. You could find the level with some trial and error, keep uploading the same video (lossless audio ideally) and keep lowering the dB floor (content loudness) with your video editor/export settings until you achieve 100%/100% without the plugin. (You can right click on the video, and choose Stats for Nerds, to see the Volume/Normalised data, to check how close you're getting) (High level content creators likely aim for 100% like you)
Good luck with your audio travels! =)
Yes, I've already done all that, and the closest I got with the same video I'm remastering is 100%/91% (0.9 dB). That's pretty damn close, but unfortunately, it only increases the volume SLIGHTLY (because it's already turned down significantly in the video editor to meet YouTube's -14 LUFS standard).
Note that I've been using CapCut, which is not the best editor in terms of this issue, and that I could probably achieve the desired effect in another video editing program. A little too late for that with the video I've already made, though, but I do know there's a way to achieve this goal without using the script, as I've seen a lot of YouTube videos lately which has the perfect score (no penalties) and which sound much louder on normal volume.
And this actually makes a lot of difference, as I'm sure you know (otherwise, why bother with these scripts, correct?) because it creates a much better and natural loud sound on normal volume, rather than just turning the volume up on your speaker manually. I'm sure you know exactly what I mean, which is why I'm so glad I found this excellent fix!
Thanks again.
@fa7ad Thanks for the reply. After testing out your version I figured out that this seems to be an issue with Firefox and Youtube most likely, as these scripts still work in Chrome but not in Firefox.