Closed Bug 1383363 Opened 8 years ago Closed 3 years ago

Firefox doesn't pitch correct sped-up or slowed-down HTML5 video (e.g. on Youtube)

Categories

(Web Compatibility :: Site Reports, defect, P2)

defect

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: nimish, Assigned: chunmin)

References

Details

(Whiteboard: [platform-rel-youtube][media-audio])

User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.72 Safari/537.36 Steps to reproduce: Go to any youtube video with a human speaking in firefox Change speed to 2x Actual results: Marvel at the new helium inhaling human speaking to you in a higher pitch Expected results: Natural pitch should have been maintained, just like chrome does
Component: Untriaged → Audio/Video: Playback
Product: Firefox → Core
Sounds like an AudioStream issue.
Flags: needinfo?(cchang)
Assignee: nobody → cchang
Flags: needinfo?(cchang)
Summary: Firefox doesn't pitch corrected sped-up or slowed-down HTML5 video (e.g. on Youtube) → Firefox doesn't pitch correct sped-up or slowed-down HTML5 video (e.g. on Youtube)
Edge also appears to correctly handle speed changes.
According to MDN, correct pitch is apparently supposed to be the default: https://developer.mozilla.org/en-US/docs/Web/API/HTMLMediaElement/playbackRate
I'm going to mark this as a P1 because it appears to be a regression.
Priority: -- → P1
Perhaps mozregression can be used to figure out if/when it got broken.
Mass change P1->P2 to align with new Mozilla triage process
Priority: P1 → P2
Any luck on this? It really is a regression going from every other browser to FF. I had a look and the audio lib ff uses is perfectly capable of decoupling playback rate and pitch in order for pitch to be correct so something is getting lost between the video element speed and the instruction to the playback library
(In reply to nimish from comment #7) > Any luck on this? It really is a regression going from every other browser > to FF. I had a look and the audio lib ff uses is perfectly capable of > decoupling playback rate and pitch in order for pitch to be correct so > something is getting lost between the video element speed and the > instruction to the playback library I agree. This bug is keeping me from using FireFox as my default browser.
platform-rel: --- → ?
Whiteboard: [platform-rel-youtube]
(In reply to nate from comment #8) > (In reply to nimish from comment #7) > > Any luck on this? It really is a regression going from every other browser > > to FF. I had a look and the audio lib ff uses is perfectly capable of > > decoupling playback rate and pitch in order for pitch to be correct so > > something is getting lost between the video element speed and the > > instruction to the playback library > > I agree. This bug is keeping me from using FireFox as my default browser. Me too. I want to move to an open source browser but I love my sped up video tutorials.
Bug is still present for me in release v62.0
Open the Web Console (Ctrl+Shift+K), paste the following line and press Enter: document.querySelector('video').mozPreservesPitch = true Does anyone hear chipmunks on Linux or is it limited to Windows?
¡Hola! Confirming based on multiple reports of the bug from various individuals. ¡Gracias! Alex
Status: UNCONFIRMED → NEW
Ever confirmed: true
Thank you. Now once this gets fixed I can finally ditch Chrome once and for all.
It is happening with Firefox Nightly v64.0a1 (2018-10-03) (64-bit) as well.
See Also: → 1427267

Any workaroud? I want to switch back to Chrome because of this.

I really watch to switch to Firefox but this issue holds me back unfortunately. Please fix this bug :)

It seems like the soundtouch library isn't updated for a while. Maybe we could try updating it first.

Fwiw, I see this complaint in https://news.ycombinator.com/item?id=20850135 too:

@ilrwbwrkhv said:

The biggest problem for me is, I like to learn by watching videos at 3x speeds. Chrome's audio pitch correction works great whereas Firefox's pitch correction makes the audio unintelligible.

Depends on: 1588233

I've tried updating the libsoundtouch to see if the audio quality improves when changing the speed. Here is the samples between the current Firefox and the version with newer libsoundtouch.

https://d3kxowhw4s8amj.cloudfront.net/file/download/5eoguu7i3g5xzmi3awer/PHID-FILE-jkhrolbbzfld42pz2ra7/samples.zip

The files starting with new means they are dumped from Firefox with updated libsoundtouch. The files starting with old means they are dumped from current Firefox Nightly. The files are based on the following two youtube video:

To be honest, I don't hear much difference in the talk show video.

nimish,
Do you have any specific video that has bad quality you mentioned? I could try a newer libsoundtouch with it to see if the quality could be improved.

Flags: needinfo?(nimish)

When downloading the file, I cannot seem to extract the samples.zip archive. I have tried both the default windows extract, and 7-zip. Can you confirm the download link works?

(In reply to C.M.Chang[:chunmin] from comment #19)
(In reply to Jeremy Rumph from comment #20)

When downloading the file, I cannot seem to extract the samples.zip archive. I have tried both the default windows extract, and 7-zip. Can you confirm the download link works?

try this one:
https://d3kxowhw4s8amj.cloudfront.net/file/download/odrvlpn3u5cdjasqvg2y/PHID-FILE-pkgcfujd7zkvtazdhyti/samples.zip

The record audios are somehow broken. They could be played but they are not seekable. I couldn't do seek the files in iTunes but I can do seek in VLC.

(In reply to C.M.Chang[:chunmin] from comment #19)

Do you have any specific video that has bad quality you mentioned? I could try a newer libsoundtouch with it to see if the quality could be improved.

Try this on 2x speed:
https://www.youtube.com/watch?v=_bN4spt3744

Here is a recording from Firefox 72.0a1 (2019-11-08) and Chrome, you can clearly hear the difference right from the beginning.
https://mega.nz/#!2qAjiagY!qSToYnCYZjrgSoe77e24N1imtrInn9fGdB7jf3hFD0o

How can i help to get this bug fixed ?
Easiest way to reproduce this bug is just to go to any youtube video inspect than just type this in the console in both chrome and firefox
a=document.querySelector('video');a.playbackRate=4.1
The audio will stop in Firefox but not in chrome however if you just set the rate to 3 i think the distortion is noticeable enough
I really would like to help get this bug fixed since i'm also one of the poor souls stuck on chromium because of it what part of the code need to be fixed ?

can firefox use rubber band instead of libsoundtouch for pitch scaling ?
also please compare firefox and chrome directly as it appears that chromium offers the best high speed audio quality at the moment better than both vlc and mpv
after configuring mpv to use rubber band instead of the default(appears it did use soundtouch by default too) i did come close to chromium quality but still not exactly the same
however it is WAY better than the default for speed higher than x2 so i think firefox can benefit greatly as well by switching to rubber band

libsoundtouch is capable of producing similar results to Chrome with the right settings, please try out the comparison recordings in Bug 1427267 comment 28.

firefox-3x-1ms sound the best for me it also sound much better than what i'm getting with my version of firefox (v71.0 on ubuntu)
I recorded this on my system
https://gofile.io/?c=69q8nv

On the latest daily release this bug is no longer an issue.
I just updated to the latest daily build on ubuntu (firefox v73.0a1hg20191216r507108) and now the pitch is pretty much the same as in chromium I finally can ditch brave and go back to firefox big thanks to all the devs.
I just wanna add that the audio still cuts off after speed goes above 4.0 (in chromium audio continue working) but i doubt anyone watch videos at 4.x speed.
This bug has finally been fixed funny that all it needed was 3 lines of code again can't thank the devs enough.

(In reply to C.M.Chang[:chunmin] from comment #19)

I've tried updating the libsoundtouch to see if the audio quality improves when changing the speed. Here is the samples between the current Firefox and the version with newer libsoundtouch.

https://d3kxowhw4s8amj.cloudfront.net/file/download/5eoguu7i3g5xzmi3awer/PHID-FILE-jkhrolbbzfld42pz2ra7/samples.zip

The files starting with new means they are dumped from Firefox with updated libsoundtouch. The files starting with old means they are dumped from current Firefox Nightly. The files are based on the following two youtube video:

To be honest, I don't hear much difference in the talk show video.

nimish,
Do you have any specific video that has bad quality you mentioned? I could try a newer libsoundtouch with it to see if the quality could be improved.

Hi, apologies for the delay, any lecture on youtube would work. The idea is that pitch-corrected voices at 2x speed should not sound higher-pitched, and should sound a little more natural.

Flags: needinfo?(nimish)
See Also: → 1618603
Whiteboard: [platform-rel-youtube] → [platform-rel-youtube][media-audio]
See Also: → 1344756

(In reply to ayko2730 from comment #27)

On the latest daily release this bug is no longer an issue.
I just updated to the latest daily build on ubuntu (firefox v73.0a1hg20191216r507108) and now the pitch is pretty much the same as in chromium I finally can ditch brave and go back to firefox big thanks to all the devs.
I just wanna add that the audio still cuts off after speed goes above 4.0 (in chromium audio continue working) but i doubt anyone watch videos at 4.x speed.
This bug has finally been fixed funny that all it needed was 3 lines of code again can't thank the devs enough.

Has the 4x sound cut off issue been fixed? Is there a bug report for that specifically?

(In reply to ayko2730 from comment #27)

On the latest daily release this bug is no longer an issue.
I just updated to the latest daily build on ubuntu (firefox v73.0a1hg20191216r507108) and now the pitch is pretty much the same as in chromium I finally can ditch brave and go back to firefox big thanks to all the devs.
I just wanna add that the audio still cuts off after speed goes above 4.0 (in chromium audio continue working) but i doubt anyone watch videos at 4.x speed.
This bug has finally been fixed funny that all it needed was 3 lines of code again can't thank the devs enough.

Hello,
I'm using Firefox 80.0.1 (64 bit windows 10) and the problem still occurs. It is very annoying, especially when you listen to the movies with musical background, e.g. of this type: https://youtu.be/zVYqNyMzp_g?t=31 (please set playback rate to something above 1x). The other examples given in this thread do not capture the problem so well. I am asking for a solution.

Hi! I am currently using Firefox 81.0; 64 Bit on Windows 10. I have audio distortion issue too. To recreate the issue you'll have to watch this video https://www.youtube.com/watch?v=jkytV1w5IeI and set playback speed to 1.5x or 2.0. You'll heare strong sound cracking espesially in the begining.

I'm having this issue with all YouTube videos on Firefox for Android.

Google Pixel 3a using Android 11.0.

Firefox Android 81.1.2 (Build #2015767043)
AC: 57.0.7, 68343a885
GV: 81.0.1-20200930150533
AS: 61.0.13

Not having this issue on Youtube but just found it on Udemy.

Version 89.0.1
User Agent Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:89.0) Gecko/20100101 Firefox/89.0
OS Windows_NT 10.0 19042

Having this problem on Udemy as well.

Version 89.0.2 (64 bit) on Windows 10.

(In reply to sportsmannnnn from comment #31)

Hi! I am currently using Firefox 81.0; 64 Bit on Windows 10. I have audio distortion issue too. To recreate the issue you'll have to watch this video https://www.youtube.com/watch?v=jkytV1w5IeI and set playback speed to 1.5x or 2.0. You'll heare strong sound cracking espesially in the begining.

I can confirm. The sound is distorted in Firefox, but not in Edge. You can hear it from the very first second.
I also have this problem on Udemy, and it's driving me nuts. Constant clicking sounds on 2.0x.
I've been using Firefox for 17 years and want to continue using it. But this problem forces me to use other browsers.

Version 89.0.2
User Agent Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:89.0) Gecko/20100101 Firefox/89.0
OS Windows_NT 10.0 18363

I've just tested the issue on the nightly build, on a different computer, with all addons switched off, and tried switching off hardware acceleration as well. None of that made any difference.

Please suggest any other ideas I can try to help with this problem.

Version 91.0a1
Build ID 20210630212829
User Agent Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Firefox/91.0
OS Windows_NT 10.0 19041

I arrived here looking for a solution and can see it's been a problem for years.

Udemy is an easy way to reproduce it, I get crackling audio after 5-10 seconds of watching any video at 1.5x speed. It's super unpleasant. I think it's worse if Firefox doesn't have foreground.

Chrome and Edge handle this just fine with no crackling.

94.0.2 (64-bit)
Windows 10 19044
i7-8850H
Realtek audio

I also arrived here looking for a solution after trying to watch an Udemy couse at 1.75x and there are a lot of "cracking sounds" as if it is struggling to keep up with the video.
At first, I thought it was a video problem, but after testing the same video on Edge I found that it played smoothly.

My computer specs are:

Firefox 95.0 (64-bit)
Realtek Audio
Processor: AMD Ryzen 9 4900HS with Radeon Graphics 3.00 GHz
OS: Windows 11 Pro Insider Preview
Version: Dev
OS build: 22518.1012
Experience Windows Feature Experience Pack 1000.22518.1012.0

Hello,

Waiting for solution of this problem is getting annoying. Maybe someone has a workaround for this problem, because we probably can't count on fixing it? Unless someone raises it to the urgent ones. I'm starting to look for an alternative browser.

Newest firefox, win 10 x64 pro.

If that happens, that means the website doesn't set mozPreservesPitch, or it only set preservesPitch.

There is an attribute on HTMLMediaElement used to control the pitch when changing the playback rate, which historically has different prefix, mozPreservesPitch and webkitPreservesPitch. That attirbute was recently unified by preservesPitch and Firefox hasn't changed that yet. Unprefix mozPreservesPitch will be done in bug 1652950.

The easiest way to fix it by youself is to set video.mozPreservesPitch = true on the video you're watching if the website doesn't do that.

Considering this is a website issue, and now Youtube did set mozPreservesPitch correctly. I will close this bug. For unprefix issue, please follow bug 1652950.

Status: NEW → RESOLVED
Closed: 3 years ago
Resolution: --- → FIXED
See Also: → 1652950

(In reply to boris.naydis from comment #35)

I can confirm. The sound is distorted in Firefox, but not in Edge. You can hear it from the very first second.
I also have this problem on Udemy, and it's driving me nuts. Constant clicking sounds on 2.0x.
I've been using Firefox for 17 years and want to continue using it. But this problem forces me to use other browsers.

In addition, for bad sound quality issue on Udemy (or other sites using DRM) when having high playback rate, that might be bug 1749804, which has been fixed.

(In reply to myaseen98 from comment #29)

Has the 4x sound cut off issue been fixed? Is there a bug report for that specifically?

That has been fixed by bug 1630569.

(In reply to Alastor Wu [:alwu] from comment #40)

If that happens, that means the website doesn't set mozPreservesPitch, or it only set preservesPitch.

There is an attribute on HTMLMediaElement used to control the pitch when changing the playback rate, which historically has different prefix, mozPreservesPitch and webkitPreservesPitch. That attirbute was recently unified by preservesPitch and Firefox hasn't changed that yet. Unprefix mozPreservesPitch will be done in bug 1652950.

The easiest way to fix it by youself is to set video.mozPreservesPitch = true on the video you're watching if the website doesn't do that.

Considering this is a website issue, and now Youtube did set mozPreservesPitch correctly. I will close this bug. For unprefix issue, please follow bug 1652950.

I've checked and video.mozPreservesPitch = true is already set for Udemy and it still produces the 'cracking' sound.
It makes me believe that this is not a website issue.

(In reply to Alastor Wu [:alwu] from comment #40)

If that happens, that means the website doesn't set mozPreservesPitch, or it only set preservesPitch.

There is an attribute on HTMLMediaElement used to control the pitch when changing the playback rate, which historically has different prefix, mozPreservesPitch and webkitPreservesPitch. That attirbute was recently unified by preservesPitch and Firefox hasn't changed that yet. Unprefix mozPreservesPitch will be done in bug 1652950.

The easiest way to fix it by youself is to set video.mozPreservesPitch = true on the video you're watching if the website doesn't do that.

Considering this is a website issue, and now Youtube did set mozPreservesPitch correctly. I will close this bug. For unprefix issue, please follow bug 1652950.

I've checked and video.mozPreservesPitch = true is already set for Udemy and it still produces the 'cracking' sound.
It makes me believe that this is not a website issue.

(In reply to rickftime from comment #43)

I've checked and video.mozPreservesPitch = true is already set for Udemy and it still produces the 'cracking' sound.
It makes me believe that this is not a website issue.

See comment 41, it has been fixed by bug 1749804.

Component: Audio/Video: Playback → Site Reports
Product: Core → Web Compatibility
Version: 56 Branch → unspecified
platform-rel: ? → ---
You need to log in before you can comment on or make changes to this bug.