Html 为什么 Firefox 不支持 <audio> 中的 MP3 文件格式

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/4923136/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-29 06:36:03  来源:igfitidea点击:

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

firefoxhtmlmp3html5-audio

提问by Mark

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

Firefox 不支持播放<audio>元素中的 MP3 文件,仅支持Ogg格式,是否有特殊原因?

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?

是否可以开发一个插件来支持<audio>元素中的MP3 播放?

采纳答案by Ian Devlin

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

许可问题:HTML5 视频和 H.264——历史告诉我们什么以及为什么我们站在网络上Mozilla 为 Firefox 仅对 Ogg​​ Theora 视频的 HTML5 支持进行辩护(尽管他们的标题,他们也谈论 MP3 许可,尽管很简短) .

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

你所能做的就是回到 Flash 并通过它播放它们。

回答by Judah Gabriel Himango

Update October 2012:Wooohooo! Brendan Eich just announced on his blogthat 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

2012 年 10 月更新:哇哦!Brendan Eich 刚刚在他的博客宣布,Firefox 中 MP3 和 H264 支持的工作正在进行中。您可以在 BugZilla 上跟踪工作:在桌面 Firefox 上支持 H.264/AAC/MP3 视频/音频播放

Update February 2013: After much heavy lifting from Firefox developer Chris Pearce, this patchflips 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.

2013 年 2 月更新:经过 Firefox 开发人员 Chris Pearce 的大力改进,此补丁翻转开关,在 Windows 7 和之后。我们应该会在下一个稳定的 FF 版本中看到一些原生 Web MP3 支持。

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.enabledand 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.

2013 年 4 月更新:哇哦!最新的稳定版 Firefox 具有对 MP3 的实验性支持。要打开它,请在 Firefox 中输入 about:config,找到media.windows-media-foundation.enabled并将其设置为 true。重启 Firefox,一切就绪;转到带有 HTML5 音频的站点(例如我的广播站点),您会看到 Firefox 确实在播放本机 MP3,而不是求助于 Flash 回退。

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.

2013 年 5 月更新:终于!Firefox 21 于今天发布,它包括对 Windows 的原生 HTML5 MP3 支持。我刚刚验证了它支持开箱即用的原生 MP3 音频,前提是您的操作系统支持它。我在 Windows 8 上进行了测试,但我相信这会在 Windows 7 和 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.

2013 年 12 月更新今天发布了 Firefox 26,它为从 Windows XP 开始的所有 Windows 版本提供原生 MP3 音频支持。



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.

Ian Devlin 目前接受的答案已过时。新的答案是:虽然出于许可原因,Firefox 历来不支持原生 MP3 播放,但将来会改变;我们很快就会看到一个通过 HTML5 <audio> 标签本地播放 MP3 的 Firefox。

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.

2012 年 3 月,Mozilla 对这个问题进行了一次转变,公开表示他们将在其原生 HTML5 实现中支持 MP3 和 H.264,前提是该编解码器已经在最终用户的系统上可用。

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

在链接的文章中,Mozilla 的研究主管 Andreas Gal 发表了以下公开声明:

“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.”

“我们将支持解码系统上现有解码器支持的任何视频/音频格式,包括 H.264 和 MP3。确实没有理由阻止我们的用户使用设备上已有的系统解码器,因此我们不会过滤任何格式。

我认为这个错误不会显着改变我们对开放视频的立场。我们将继续推广和支持开放式编解码器,但在设备上已经安装和许可现有编解码器的时间和地点,我们将利用它们为人们提供最佳体验。”

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

这与他们之前的位置形成对比,即使操作系统支持,他们也不会尝试播放 MP3 和 H.264。

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. EditOctober 2012: Indeed, this speculation was correct: native MP3 and H264 playback in desktop Firefox is now under development.

底线:Firefox 最终将在其 HTML5 <audio> 实现中支持 MP3。截至 2012 年 9 月,我看不到有关何时会发生这种情况的信息。它似乎正在为 Droid 上的 Firefox 开发;我推测我们很快就会在桌面版 Firefox 中看到支持。2012 年 10 月编辑:确实,这种猜测是正确的:桌面 Firefox 中的本机 MP3 和 H264 播放现在正在开发中

回答by ZJR

UPDATE: Native MP3 (and H264) support is now availableon 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(和 H264)支持现在可用于桌面版 Firefox 20+

我也用它来关注播客和偶尔的 mp4 视频。

如果它不起作用,则有一个隐藏选项可以启用
about:config → media.windows-media-foundation.enabled → true

它也适用于HTML5 YouTube
(无论如何都应该使用webm,但可能更适合h264

MP3 usually is a Fraunhofer/Thomsonpatents problem. They sell their licenses on the slightly shady mp3licensing.comdomain.

MP3 通常是Fraunhofer/Thomson专利问题。他们在略显阴暗的mp3licensing.com域上出售他们的许可证。

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

关于专利(更新 2016/6)(维基百科):

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.

MP3 的基本解码和编码技术在欧盟是无专利的,所有专利在那里都已过期。在美国,该技术将于 2017 年 12 月 31 日基本免专利(见下文)。大多数 MP3 专利在 2007 年至 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.

[...] 专利在首次申请日后 20 年到期,而在其他国家/地区的申请可能会延迟 12 个月。因此,大多数国家/地区实施 MP3 所需的专利在 ISO CD 11172 发布 21 年后,即 2012 年 12 月到期。

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

至于2017年12月在美国最终到期的专利:

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.

除三项专利外,Sisvel 管理的美国专利均已于 2015 年到期(例外情况包括:美国专利 5,878,080,2017 年 2 月到期,美国专利 5,850,456,2017 年 2 月到期,美国专利 5,960,037,2017 年 4 月 9 日到期。

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.

[...] MP3 技术将于 2017 年 12 月 30 日在美国免专利,届时由 Fraunhofer-Gesellschaft 持有并由 Technicolor 管理的美国专利 5,703,999 到期。

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

有一些软件可以绕过这些专利,例如LAME MP3 编码器,但它们仅以源代码形式分发。

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

LAME 开发人员表示,由于他们的代码仅以源代码形式发布,因此应仅将其视为对 MP3 编码器的教育性描述

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

然后是LAME 的二进制发行版,正如您从域中可以轻松看到的那样,它们源自阿根廷。之所以会发生这种情况,是因为 MP3 专利在许多国家/地区都被视为无效,而在这些国家/地区从未对软件专利的概念进行立法。

(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)

(我想有一份详尽的国家清单,但情况变化很快,我什至不知道我的国家在软专利方面站在哪一边。这不是 Mozilla 想要应对的不确定性和)

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

话又说回来,Mozilla的可能已经发现及其周围的专利问题的一种方法。

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

这并不完美。(即它让 linux 陷入一滩泥泞中)

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

Mozilla 的研究总监 Andreas Gal 写道:(
不过讨论都是围绕B2G 展开的,真的看了整篇文章才形成意见)

“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.”

“我们将支持解码系统上现有解码器支持的任何视频/音频格式,包括 H.264 和 MP3。确实没有理由阻止我们的用户使用设备上已有的系统解码器,因此我们不会过滤任何格式,”他写道。“我认为这个错误不会显着改变我们对开放视频的立场。我们将继续推广和支持开放式编解码器,但在设备上已经安装和许可现有编解码器的时间和地点,我们将利用它们为人们提供最佳体验。”

So, from what I see:

所以,就我所见:

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

WindowsMac(使用已获得操作系统许可的 dll/dylibs)上,Mozilla 最终可能会支持 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 Audacitydoes.

Linux 上...我想知道。也许在选定的国家/地区,您最终会安装一些未经许可的库并像Audacity那样逃脱。

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

隧道尽头有一盏灯,但我们只希望它不是一列快速驶近的火车。

回答by darioo

Taken from Wikipedia, for MP3:

摘自维基百科,用于MP3

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

MPEG-1 或 MPEG-2 音频第 3 层(或 III),通常称为 MP3,是一种使用有损数据压缩形式的获得专利的数字音频编码格式。

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 patentsand is designed to provide for efficient streaming and manipulation of high quality digital multimedia.

Ogg 是由 Xiph.Org 基金会维护的免费、开放的标准容器格式。Ogg 格式的创建者表示,它不受软件专利的限制,旨在提供高质量数字多媒体的高效流媒体和操作。

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

Mozilla 不想要专利问题,所以 Ogg 被选为更好的候选人。

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.

可以进行这样的实现,以便 Firefox 可以在<audio>标签中播放 mp3 ,但是由于我提到的问题,这不会完成。

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

有时,和其他现实世界的问题会决定什么可以实施,什么不能实施。

回答by NVRM

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

对于Linux对HTML5的流转MP3,MP4,H.264AAC,你必须设定media.gstreamer.enabledtrueabout:config

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

Gstreamer 存在于大多数(如果不是全部)Linux 发行版中!

回答by Tyson

I believe that the Mozilla developers decided against implementing MP3 support, in order to avoid paying for patent licences from a number of organisations (Technicolor/Thomson Consumer Electronics, the Fraunhofer Institute, Alcatel-Lucent, Sisvel and potentially others, from what I can gather).

我相信 Mozilla 开发人员决定不实施 MP3 支持,以避免支付来自许多组织(Technicolor/Thomson Consumer Electronics、Fraunhofer Institute、Alcatel-Lucent、Sisvel 和可能的其他组织,据我所知)的专利许可)。

回答by chichilatte

Decoding of various audio formats, including MP3 files, can now be done in modern browsers using JavaScript. http://audiocogs.org/codecs/mp3/

现在可以使用 JavaScript 在现代浏览器中解码各种音频格式,包括 MP3 文件。http://audiocogs.org/codecs/mp3/

If a site used this kind of code (or a Firefox add-on did), Firefox would play MP3 files just fine.

如果网站使用这种代码(或 Firefox 插件使用),Firefox 就可以很好地播放 MP3 文件。

回答by Diego

As already said it's a patent problem. There are already plenty of open source MP3 decoders and encoders implementations (among them are LAMEand FFmpeg), the problem is that to ship binaries somebody has to pay for the patent license. Here's a quote from LAME wikipedia articleconfirming this:

如前所述,这是一个专利问题。已经有很多开源 MP3 解码器和编码器实现(其中包括LAMEFFmpeg),问题是要运送二进制文件,必须有人支付专利许可费用。以下是LAME 维基百科文章的引述,证实了这一点:

Like all MP3 encoders, LAME implements some technology covered by patents owned by the Fraunhofer Society and other entities. The developers of LAME do not themselves license the technology described by these patents. Distributing compiled binaries of LAME, its libraries, or programs that derive from LAME in countries that recognize those patents may be patent infringing. 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, and thus does not infringe any patent by itself when released as source code only. At the same time, they advise users to obtain a patent license for any relevant technologies that LAME may implement before including a compiled version of the encoder in a product.

与所有 MP3 编码器一样,LAME 实施了一些由弗劳恩霍夫协会和其他实体拥有的专利所涵盖的技术。LAME 的开发者自己并不许可这些专利所描述的技术。在承认这些专利的国家/地区分发 LAME 的编译二进制文件、其库或源自 LAME 的程序可能构成专利侵权。LAME 开发者表示,由于他们的代码仅以源代码形式发布,因此应仅将其视为对 MP3 编码器的教育性描述,因此仅作为源代码发布时其本身并不会侵犯任何专利。同时,他们建议用户在将编码器的编译版本包含在产品中之前,获得 LAME 可能实施的任何相关技术的专利许可。

Mozilla obviously cannot afford to pay patents for any copy of Firefox that gets downloaded.

Mozilla 显然无法为下载的任何 Firefox 副本支付专利费用。

The two possible solutions are:

两种可能的解决方案是:

  • use external codecsalready preinstalled in the system Firefox is installed in. This solution is the one that has been adopted when running in Windows as mentioned in this other answer. In this case, if the Microsoft MP3 codec is used, Microsoft is the one who paid for the patent license, cost which is part of the Windows license;
  • wait for MP3 patents to expire. The last one will probably expire on April 16, 2017which is roughly 3 years and a half from now, but time passes steadily! Firefox 1.0 came out on November 9, 2004, which is more than 9 years ago!

That's why using patent free codecs is, from a user perspective standpoint, more desirable!

这就是为什么从用户角度来看,使用无专利编解码器更可取!

2017 UPDATE:patents have expired and open source projects are now starting to pick up MP3 support, e.g. Fedora. Let's hope Firefox does the same soon!

2017 更新:专利已过期,开源项目现在开始获得 MP3 支持,例如 Fedora。让我们希望 Firefox 尽快做同样的事情!