WofWca / jumpcutter

⏩ Fast-forwards long pauses between sentences — watch lectures ~1.5x faster (browser extension)
https://chrome.google.com/webstore/detail/jump-cutter/lmppdpldfpfdlipofacekcfleacbbncp
GNU Affero General Public License v3.0
356 stars 13 forks source link

Video freezes / stutters on Firefox (Gecko) #186

Closed WofWca closed 1 week ago

WofWca commented 1 week ago

I.e. the FPS gets super low (like 0.5 - 1 frames per second).
This looks a lot like a browser regression bug. If the video is routed through AudioContext and the playback rate gets set to > 6.5, this starts happening. It's easier to reproduce for higher-resolution video.

This happens even without the extension:

ctx = new AudioContext();
v = document.querySelector('video');
src = ctx.createMediaElementSource(v);
src.connect(ctx.destination);
v.playbackRate = 7.5

It starts happening after a few seconds after the execution of the above code. Seeking the video temporarily fixes the issue. Setting playbackRate back to a lower value of 1 doesn't get rid of the freezes.

I was able to reproduce this on the following Firefox versions: 134.0a1, 132.0.1, 130.0b9, 128.4.0esr, 107.0.1, 103.0.2, 103.0.

On 116.0b8 it still starts to freeze, but switching the speed back to 1 eventually restores normal behavior. Hmmm or not. If you change playback rate a lot of times, it still becomes sluggish. On 92.0b9, 97.0b9, 100.0.2, 101.0.1, 102.9.0esr I was unable to reproduce the bug at all, so looks like 103.0 is the first version with this bug.

It also looks like switching playbackRate often has to makes it more easily reproducible:

ctx = new AudioContext();
v = document.querySelector('video');
src = ctx.createMediaElementSource(v);
src.connect(ctx.destination);

switchesLeft = 20;
intervalId = setInterval(() => {
    v.playbackRate = 8;
    // v.playbackRate = 8.25; // (a muted speed) also makes the bug appear.

    switchesLeft--;
    if (switchesLeft <= 0) {
        clearInterval(intervalId);
        v.playbackRate = 1;
        console.log('back to normal speed');
        return;
    }

    setTimeout(() => {
        v.playbackRate = 1.25;
    }, 100)
}, 300)

Tested on this video: https://download.blender.org/demo/movies/BBB/bbb_sunflower_1080p_30fps_normal.mp4.zip playing the local file, and some other local files. On YouTube I was unable to reproduce this.

This was reported by one of the users.

Workarounds

WofWca commented 1 week ago

I submitted a bug report https://bugzilla.mozilla.org/show_bug.cgi?id=1931328

WofWca commented 1 week ago

The bug has been confirmed by Mozilla, I'll close this as an upstream issue. For workarounds, see the original post above.