A Greasemonkey/Tampermonkey script to down-mix YouTube videos to mono

You may have had the annoyance of trying to watch a YouTube video with only one ear because the audio was recorded as mono but exported to YouTube in stereo. I too was frustrated with this issue tonight so I wrote a quick script to remedy it. It can be used by Tampermonkey (Chrome) and Greasemonkey (Firefox).

By default it applies to all YouTube videos, this means that any stereo effects will go away. You’ll still hear both channels, but as only a single duplicated channel. I suggest keeping it disabled and only enabling it when you encounter a problematic video.

// ==UserScript==
// @name         YouTube Mono down-mix
// @namespace    https://mikedombrowski.com/2019/03/fix-youtube-mono-one-ear-audio/
// @version      1.0
// @description  Down-mix YouTube videos to mono to fix right or left ear only videos.
// @author       Michael Dombrowski
// @match        https://www.youtube.com/watch?v=*
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

    window.addEventListener('load', function() {
        var context = new AudioContext();
        var videos = document.getElementsByTagName("video");
        var audioElement = context.createMediaElementSource(videos[0]);
        context.destination.channelCount = 1;
        audioElement.connect(context.destination);
    }, false);
})();

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.