Closed Bug 1796532 Opened 2 years ago Closed 2 years ago

Audibly glitchy 24 kHz MP3 decoding

Categories

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

Firefox 106
defect

Tracking

()

RESOLVED FIXED
108 Branch
Tracking Status
firefox108 --- fixed

People

(Reporter: maikmerten, Assigned: padenot)

References

(Blocks 1 open bug)

Details

Attachments

(4 files)

User Agent: Mozilla/5.0 (X11; Linux x86_64; rv:106.0) Gecko/20100101 Firefox/106.0

Steps to reproduce:

Playing back 24 kHz MP3 files. A sample file is available at https://maikmerten.de/public/mp3-decoder-tests/bla24-v7.mp3

Actual results:

Audio playback of the sample file contains high-frequency chirp noises in Firefox. Listening with headphones greatly helps detecting the artifacts.

For reference, a sample decode with degraded audio quality is available at https://maikmerten.de/public/mp3-decoder-tests/decoded-ffmpeg.flac

This is caused by a bug in ffmpeg's MP3 decoder shipping with Firefox. A discussion of the bug is available over at https://hydrogenaud.io/index.php/topic,123198

Expected results:

Playback of the sample MP3 file should not contain high-frequency chirp noises.

For reference, a correctly decoded sample (without high-frequency chirps) is available at https://maikmerten.de/public/mp3-decoder-tests/decoded-lame.flac

The root of the audio quality degradation are incorrect values in a lookup table for the MPEG-2 24 kHz MP3 mode. These have since been corrected in ffmpeg with following commit: https://git.ffmpeg.org/gitweb/ffmpeg.git/commit/37efcb473f2e2e930339c176492fdc45b578448b

Mozilla's copy still has the incorrect values: https://hg.mozilla.org/mozilla-central/file/tip/media/ffvpx/libavcodec/mpegaudiodec_common.c

The Bugbug bot thinks this bug should belong to the 'Core::Audio/Video: Playback' component, and is moving the bug to that component. Please correct in case you think the bot is wrong.

Component: Untriaged → Audio/Video: Playback
Product: Firefox → Core

Analogous Chromium bug is tracked over at https://bugs.chromium.org/p/chromium/issues/detail?id=1376973

Assignee: nobody → padenot
Status: UNCONFIRMED → ASSIGNED
Ever confirmed: true
Pushed by padenot@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/02ab0b6c0713 Update vendored ffmpeg to revision 0957d62f. r=alwu https://hg.mozilla.org/integration/autoland/rev/f35fdcd00b92 Update our config_component files to add missing new define. r=alwu https://hg.mozilla.org/integration/autoland/rev/f446b3e633af Rebase in-tree patch over vendored ffmpeg. r=alwu https://hg.mozilla.org/integration/autoland/rev/3ace3ff557d1 Re-apply in-tree patch over vendored ffmpeg. r=alwu
Blocks: 1799132

Hi, maikmerten! Could you please help us verify this fix on the latest Beta builds?

Unfortunately, I am not hearing any differences when comparing an affected Nightly build (2022-10-20), and latest Beta 108.0b3. I've checked with Win 10 x64, Ubuntu 18.04 x64 and macOS 11.

Flags: needinfo?(maikmerten)

Hi, I'll gladly give the beta builds a try and report back!

(The difference in audio is rather subtle. Affected decoders sound like https://maikmerten.de/public/mp3-decoder-tests/decoded-ffmpeg.flac and correct decoders sound like https://maikmerten.de/public/mp3-decoder-tests/decoded-lame.flac - one needs headphones to spot the difference.)

Flags: needinfo?(maikmerten)

Hello, I tried firefox-108.0b3.tar.bz2 and firefox-109.0a1.en-US.linux-x86_64.tar.bz2 on Ubuntu Linux 22.04, downloaded minutes ago. The distortion is still there for both builds. Is Firefox on Linux using a platform MP3 decoder?

Hi, Paul! Could you please take a look at what maikmerten commented above?

Flags: needinfo?(padenot)

The original ffmpeg bug report (https://trac.ffmpeg.org/ticket/1958) contains a very easy to check test case: https://trac.ffmpeg.org/attachment/ticket/1958/resample_24000_V_0.mp3

This is a frequency sweep. WARNING: Loud and unpleasant. Between seconds ~34 and ~36 affected ffmpeg decoders will emit very audible distortions.

The Linux beta build I downloaded today produces these distortions.

(In reply to maikmerten from comment #11)
Is Firefox on Linux using a platform MP3 decoder?

It's not supposed to, but it does. I'll fix this, thanks for reporting back and verifying carefully.

Flags: needinfo?(padenot)
Depends on: 1802513
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: