Why doesn't Firefox support the MP3 file format in <audio>

85,936

Solution 1

Licensing issues: HTML5 video and H.264 – what history tells us and why we’re standing with the web and Mozilla defends Firefox's HTML5 support for only Ogg Theora video (despite their titles, they both also talk about MP3 licensing, albeit briefly).

All you can do is fall back to Flash and play them through that.

Solution 2

Update October 2012: Wooohooo! Brendan Eich just announced on his blog that work for MP3 and H264 support in Firefox is underway. You can track the work on BugZilla: Support H.264/AAC/MP3 video/audio playback on desktop Firefox

Update February 2013: After much heavy lifting from Firefox developer Chris Pearce, this patch flips the switch to enable MP3, MP4, H.264, and AAC playback by default in HTML5 <audio> and <video> elements when running on Windows 7 and later. We should see some native web MP3 support in the next stable FF release.

Update April 2013: Woohooo! The latest stable Firefox has experimental support for MP3. To turn it on, type about:config in Firefox, find media.windows-media-foundation.enabled and set it to true. Restart Firefox, and you're all set; go to a site with HTML5 audio (e.g. my radio site) and you'll see Firefox is indeed playing the native MP3 and not resorting to a Flash fallback.

Update May 2013: At last! Firefox 21 was released today, and it includes native HTML5 MP3 support on Windows. I just verified it supports native MP3 audio out-of-the-box, provided your operating system supports it. I tested on Windows 8, but I believe this will automatically work on Windows 7 and Vista.

Update December 2013: Firefox 26 was released today, which gives native MP3 audio support for all versions of Windows going back to Windows XP.


The currently-accepted answer by Ian Devlin is obsolete. The new answer is: while Firefox has historically not supported native MP3 playback for licensing reasons, this will change in the future; we'll soon see a Firefox that plays MP3 natively via the HTML5 <audio> tag.

In March 2012, Mozilla did an about-face on this issue, stating publicly they'll support MP3 and H.264 in their native HTML5 implementation, provided the codec is already available on the end user's system.

In the linked article, Mozilla's director of research, Andreas Gal, makes the following public statements:

“We will support decoding any video/audio format that is supported by existing decoders present on the system, including H.264 and MP3. There is really no justification to stop our users from using system decoders already on the device, so we will not filter any formats.

I don’t think this bug significantly changes our position on open video. We will continue to promote and support open codecs, but when and where existing codecs are already installed and licensed on devices we will make use of them in order to provide people with the best possible experience.”

This is in contrast to their previous position, which didn't attempt MP3 and H.264 playback even if the operating system supported it.

Bottom line: Firefox will eventually support MP3s in its HTML5 <audio> implementation. As of September 2012, I see no information about when this will happen. It appears to be under development for Firefox on Droid; I speculate we'll see support in desktop Firefox soon afterwards. Edit October 2012: Indeed, this speculation was correct: native MP3 and H264 playback in desktop Firefox is now under development.

Solution 3

UPDATE: Native MP3 (and H264) support is now available on desktop Firefox version 20+

I'm using it to follow podcasts, and the occasional mp4 video, too.

If it doesn't work, there's an hidden option to enable:
about:config → media.windows-media-foundation.enabled → true

It also works with HTML5 YouTube
(that should anyway use webm, but might be more fine tuned for h264)

MP3 usually is a Fraunhofer/Thomson patents problem. They sell their licenses on the slightly shady mp3licensing.com domain.

Regarding patents (update 2016/6) (Wikipedia):

The basic MP3 decoding and encoding technology is patent-free in the European Union, all patents having expired there. In the United States, the technology will be substantially patent-free on 31 December 2017 (see below). The majority of MP3 patents expired in the US between 2007 and 2015.

and

[...] patents expire 20 years after the initial filing date, which can be up to 12 months later for filings in other countries. As a result, patents required to implement MP3 expired in most countries by December 2012, 21 years after the publication of ISO CD 11172.

As to patents finally expire in the US in December 2017:

Except for three patents, the US patents administered by Sisvel had all expired in 2015, however (the exceptions are: U.S. Patent 5,878,080, expires February 2017, U.S. Patent 5,850,456, expires February 2017 and U.S. Patent 5,960,037, expires 9. April 2017.

as well as

[...] the MP3 technology will be patent-free in the United States on 30 December 2017 when U.S. Patent 5,703,999, held by the Fraunhofer-Gesellschaft and administered by Technicolor, expires.

There is software circumventing those patents, like the LAME MP3 encoder, but they do that by distributing only in source code form.

The LAME developers state that, since their code is only released in source code form, it should only be considered as an educational description of an MP3 encoder

Then there are binary distributions of LAME, and, as you can easily see from the domain, they originate from Argentina. This can happen because MP3 patents are deemed invalid in many countries where the very concept of software patent was never legislated upon.

(I'd like to have an exhaustive list of countries, but the situation evolves quite rapidly, and I don't even known what side of the soft-patents divide my country stands in. That's not a level of uncertainty Mozilla wants to cope with)

Then again, Mozilla may have found THEIR way around the patent problem.

It's not perfect. (i.e. it leaves linux in a puddle of mud)

Andreas Gal, Mozilla’s director of research wrote:
(but the discussion revolved around B2G, really read the whole article to form an opinion)

“We will support decoding any video/audio format that is supported by existing decoders present on the system, including H.264 and MP3. There is really no justification to stop our users from using system decoders already on the device, so we will not filter any formats,” he wrote. “I don’t think this bug significantly changes our position on open video. We will continue to promote and support open codecs, but when and where existing codecs are already installed and licensed on devices we will make use of them in order to provide people with the best possible experience.”

So, from what I see:

On Windows and Mac (using, already licensed by the OS, dlls/dylibs) Mozilla could end up supporting MP3.

On Linux... I'd like to know. Maybe in selected countries, you'll end up installing some unlicensed libs and get away the way Audacity does.

There's a light at the end of a tunnel, but let's just hope it's not a fast approaching train.

Solution 4

Taken from Wikipedia, for MP3:

MPEG-1 or MPEG-2 Audio Layer 3 (or III), more commonly referred to as MP3, is a patented digital audio encoding format using a form of lossy data compression.

Taken for Ogg:

Ogg is a free, open standard container format maintained by the Xiph.Org Foundation. The creators of the Ogg format state that it is unrestricted by software patents and is designed to provide for efficient streaming and manipulation of high quality digital multimedia.

Mozilla doesn't want patent issues, so Ogg was chosen as the better candidate.

It is possible to make such an implementation, so that Firefox can play mp3 in <audio> tag, but this won't be done because of issues I mentioned.

Sometimes politics, and other real world issues, dictate what gets implemented and what doesn't.

Solution 5

For Linux to turn on HTML5 streaming for MP3, MP4, H.264, and AAC, you got to set media.gstreamer.enabled to true into about:config!

Gstreamer is present in most, if not all, Linux distributions!

Share:
85,936
Mark
Author by

Mark

CTO at CareSwitch

Updated on July 08, 2022

Comments

  • Mark
    Mark almost 2 years

    Is there a particular reason why Firefox does not support playback of MP3 files in <audio> elements, only Ogg format?

    Is it a licensing issue?

    Are there any plans made for a possible future implementation?

    Is it possible to develop an addon to support MP3 playback in <audio> elements?

  • Skyler Johnson
    Skyler Johnson about 13 years
    There aren't any patent issues; Mozilla just doesn't want to pay the fees for licensing the tech. And technically, they couldn't release that tech as open-source, which kind of ruins their whole schtick. What that means in the real world, is that people like you and me are unable to play back the world's most ubiquitous audio format in Firefox. This is bad for users.
  • Stefan Steiger
    Stefan Steiger over 12 years
    Because the MP3-compression algorithm is patent-protected by the Frauenhofer Institute IIS (iis.fraunhofer.de). If they would do that, they could no longer distribute Firefox for free. The better question is: Why don't Apple & Microsoft support ogg vorbis, which is (and always has been and always will be) a completely free file format, with quality and compression just as good as mp3, if not better...
  • Judah Gabriel Himango
    Judah Gabriel Himango about 12 years
    Hooray for pragmatism over dogmatism. Any idea when Firefox will start pseudo-supporting MP3? As of May 2012, Firefox v12 still doesn't support native MP3 playback, even if it's installed on the system.
  • Judah Gabriel Himango
    Judah Gabriel Himango about 12 years
    This answer is now outdated. Mozilla has done an about-face on this issue, they've committed to support MP3 and H.264 on devices where the system already supports playback. webmonkey.com/2012/03/…
  • Eonasdan
    Eonasdan almost 12 years
    @JudahHimango Mozilla still doesn't support this in the desktop version developer.mozilla.org/En/…
  • Judah Gabriel Himango
    Judah Gabriel Himango almost 12 years
    @Eonasdan It's unclear how old that documentation is. Do you know?
  • Eonasdan
    Eonasdan almost 12 years
    @JudahHimango no, I'm not sure. I looked for a reference date but didn't see one. It also appears that most of the websites talking about the audio seem to suggest that FF still doesn't support it
  • robertc
    robertc almost 12 years
    @Eonasdan Here is the defect which tracks the implementation, appears to be only for Firefox for Android.
  • robertc
    robertc almost 12 years
    @JudahHimango The last updated date on the Mozilla documentation is at the bottom of the page
  • Judah Gabriel Himango
    Judah Gabriel Himango over 11 years
    If I'm not mistaken, that only works on browsers that support the new browser audio synthesis APIs. At the time of this writing, that includes Safari, iOS Safari, and Firefox.
  • Judah Gabriel Himango
    Judah Gabriel Himango over 11 years
    Mozilla is now working on native MP3 <audio> support in desktop Firefox: stackoverflow.com/a/12203792/536
  • Blazemonger
    Blazemonger over 11 years
    Ian's answer isn't obsolete until Firefox actually follows through on their promise. Which might be any time at all.
  • Judah Gabriel Himango
    Judah Gabriel Himango over 11 years
    I disagree. Ian's answer is, "Mozilla doesn't support MP3 for licensing issues." This information is obsolete. The new answer is, "Mozilla is now working on MP3 support where the native system supports it." (Truth be told, they've already enabled support in some of the unstable builds: bugzilla.mozilla.org/show_bug.cgi?id=799315)
  • idbehold
    idbehold over 11 years
    The February 2013 update is great progress! However... it is mostly meaningless until all Firefox desktop clients support it. I know they're working hard on getting support in Linux builds, but as far as I'm aware there has been absolutely no work done on the Mac version.
  • Diego
    Diego over 10 years
    @SkylerJohnson: Like said in other answers the problem is related to patents, and as other answers reported there are open source implementations of MP3 decoder.
  • hai
    hai over 10 years
    Firefox in new version (v 25) support mp3 files too
  • Judah Gabriel Himango
    Judah Gabriel Himango over 10 years
    As of December 2013, all Firefox versions for Windows now support native MP3 playback. Also, it appears Firefox for Mac has support for native MP3 as well based on the v26 release notes: mozilla.org/en-US/firefox/26.0/releasenotes
  • Cedric Reichenbach
    Cedric Reichenbach over 10 years
    Wow, that worked for me. But I think codecs need to be installed anyway (on Ubuntu: ubuntu-restricted-extras), right?.
  • mirabilos
    mirabilos about 7 years
    This question is also linked from marco.org/2017/05/15/mp3-isnt-dead which explains the post-April 2017 situation in more detail.
  • Curious Developer
    Curious Developer almost 7 years
    Which codes are required for mp3 to work in Firefox? I am working on a project where the user records few words. These words are played and used by users. Now these users can use any platform and browsers. My goal is to make sure that the file run properly. My mp3 file some time work on Firefox and sometimes not and this is making my code to fail in Firefox. Which codes should I add in mp3 file to make it playable in all browsers on all platforms? Without making user to make changes in their browsers.