Open Bug 1383363 Opened 3 years ago Updated 2 months ago

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

Categories

(Core :: Audio/Video: Playback, defect, P2)

56 Branch
defect

Tracking

()

Tracking Status
platform-rel --- ?
firefox62 --- affected

People

(Reporter: nimish, Assigned: chunmin)

References

Details

(Whiteboard: [platform-rel-youtube])

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: → 1515054
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)
You need to log in before you can comment on or make changes to this bug.