Html HTML5 使用什么视频格式以及为什么它与 iPad 上的 Safari 兼容

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/2541455/
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 02:36:08  来源:igfitidea点击:

What video format does HTML5 use and why is it compatible with Safari on the iPad

htmlmobile-safari

提问by Keith Adler

What video format does HTML5 support that is compatible with the iPhone/iPad? I was thinking of putting together a website with some instructional videos and I'm now confused as I thought that only Quicktime was supported by Apple mobile devices.

HTML5 支持什么视频格式,兼容 iPhone/iPad?我想把一些教学视频放在一个网站上,现在我很困惑,因为我认为 Apple 移动设备只支持 Quicktime。

采纳答案by Rich Bradshaw

It uses H.264 - though this isn't described as having to be used by the HTML5 spec. Most browsers (IE9, Chrome, Safari) use H.264, though currently Firefox only supports OGG when using the video tag.

它使用 H.264 - 尽管 HTML5 规范并未将其描述为必须使用。大多数浏览器(IE9、Chrome、Safari)使用 H.264,但目前 Firefox 仅在使用视频标签时支持 OGG。

If you aren't sure what to do, try this project: http://code.google.com/p/html5media/it lets you use the video tag with an H.264 video, then backports it to older IEs using a flash fallback.

如果您不确定该怎么做,请尝试以下项目:http: //code.google.com/p/html5media/它允许您将视频标签与 H.264 视频一起使用,然后使用闪退。

回答by Roman A. Taycher

Its not Ogg Theora and never will be H.264. They were going to put Ogg Theora but Nokia and Apple disagreed because of Hardware Acceleration, Stupid patent fud, compression/quality concerns , and wanting to push the non-free(beer/freedom) H.264. So they didn't include specific codecs in the spec (also screwing over good quality/compression ratio and free Ogg Vorbis audio codec). H.264 is not going into the spec, but unfortunately it might end up being "the practical choice for a while".

它不是 Ogg Theora,也永远不会是 H.264。他们本来打算使用 Ogg Theora,但诺基亚和苹果不同意,因为硬件加速、愚蠢的专利、压缩/质量问题,以及想要推动非免费(啤酒/自由)H.264。所以他们没有在规范中包含特定的编解码器(也搞砸了良好的质量/压缩比和免费的 Ogg Vorbis 音频编解码器)。H.264 没有进入规范,但不幸的是,它可能最终成为“一段时间的实际选择”。

Ogg Theora currently has a lead in percentage of html5 browsers market share(Firefox+Opera+Chrome+some others>Safari+Chrome+IE9 Preview+ some others) , on the other hand H.264 is easier to use both with flash as a fall back if the browser doesn't support html 5 video or html 5 video with H.264 codecs(Ogg Theora can be played with Java and maybe Silverlight plugins but those are not as popular/ubiquitous as flash). Plus people tend to care (I would argue too much over iphone/ipad which support H.264, note Android supports both ).

Ogg Theora 目前在 html5 浏览器的市场份额百分比上处于领先地位(Firefox+Opera+Chrome+一些其他>Safari+Chrome+IE9 Preview+一些其他),另一方面 H.264 更容易使用,flash 作为下降如果浏览器不支持带有 H.264 编解码器的 html 5 视频或 html 5 视频(Ogg Theora 可以使用 Java 和 Silverlight 插件播放,但这些插件不像 Flash 那样流行/无处不在),则返回。另外人们往往会关心(我会在支持 H.264 的 iphone/ipad 上争论太多,注意 Android 支持两者)。

I was hoping Microsoft would decide to be open and screw apple at the same time by supporting VC-1 and Theora but unfortunately they seem to have dicded to go with H.264, hopefully they will change their minds and include Theora in the final ie9 release or that may be the end of the war. Firefox and Opera will not support H.264 unless the war is lost but might or might not afterwards using gstreamer(with directshow/quicktime providing the nonfree codecs).

我希望微软能够通过支持 VC-1 和 Theora 来决定同时开放和拧苹果,但不幸的是他们似乎已经决定采用 H.264,希望他们能改变主意并将 Theora 包含在最终的 ie9 中释放或那可能是War的结束。除非War失败,否则 Firefox 和 Opera 将不支持 H.264,但之后可能会或可能不会使用 gstreamer(使用 directshow/quicktime 提供非自由编解码器)。

Ipad supports H.264(I think it uses Quicktime but I think it might limit other Quicktime formats)

Ipad 支持 H.264(我认为它使用 Quicktime 但我认为它可能会限制其他 Quicktime 格式)

    .........IE9 preview    Firefox>3.5    Opera>10.5   Safari  Chrome     GtkWebkit QtWebkit
         (might change hopefully)     
Audio    mp3/AAC    Ogg Vorbis/WAV Ogg Vorbis/WAV   mp3/AAC Ogg Vorbis/mp3 *1       *2
                                 *5            *3                      *4

Video     H.264     Ogg Theora     Ogg Theora     H.264   Ogg Theora/H.264  *1      *2
                                 *5            *3

*1 System codecs:Gstreamer(probably free codecs(ogg), good chance of many non free codecs including H.264/mp3 either bought from fluendo or packaged with non free linux cd/computer or installed by user possibly slightly illegal but common/easy/little chance of punishment)

*1 系统编解码器:Gstreamer(可能是免费的编解码器(ogg),许多非免费的编解码器,包括 H.264/mp​​3 或从fluendo 购买或与非免费的 linux cd/计算机一起打包或由用户安装的可能略有非法但很常见/容易/很少有机会受到惩罚)

*2 System codecs:Phonon (Gstreamer/xine/vlc/Direct show/Quicktime backends)- on linux mostly gstreamer/xine

*2 系统编解码器:Phonon (Gstreamer/xine/vlc/Direct show/Quicktime backends)- 在 linux 上主要是 gstreamer/xine

*3 Gstreamer shipping only free codecs on win/mac os x, using System codecs

*3 Gstreamer 仅在 win/mac os x 上提供免费编解码器,使用系统编解码器

*4 might support AAC???

*4 可能支持AAC???

*5 In mobile firefox/fennec planning to use Gstreamer, I think, might use it everywhere ala opera later on.

*5 在计划使用 Gstreamer 的移动 firefox/fennec 中,我认为以后可能会在任何地方使用它。

回答by Alex Ford

The iPad can play HTML5 <video>elements in a .mov or .mp4 container using the H.264 codec.

iPad 可以<video>使用 H.264 编解码器在 .mov 或 .mp4 容器中播放 HTML5元素。

Safari on the Mac can play anyfile that QuickTime can play.

Mac 上的 Safari 可以播放QuickTime 可以播放的任何文件。

It's important to stress that QuickTime isn't a codec, it's a container format. A QuickTime (.mov) file can contain one of many possible codecs (H.264, etc.). Not all .mov files should be treated equally as "QuickTime" files in regards to what/where they can be played and what codec they are. This is a similar concept to .AVI—it's a container format that can deliver several codecs.

需要强调的是QuickTime 不是编解码器,而是一种容器格式。QuickTime (.mov) 文件可以包含许多可能的编解码器之一(H.264 等)。并非所有 .mov 文件都应该被视为“QuickTime”文件,因为它们可以播放的内容/位置以及它们是什么编解码器。这与 .AVI 的概念相似——它是一种容器格式,可以提供多种编解码器。

回答by Can Berk Güder

The HTML5 specification doesn't (yet) state which format(s) can/should be used.

HTML5 规范(还)没有说明可以/应该使用哪种格式。

Currently, H.264 is the most widely used, but some browsers (most notably Firefox) don't support H.264.

目前,H.264 是使用最广泛的,但一些浏览器(尤其是 Firefox)不支持 H.264。

H.264's biggest rival is Ogg Theora, but it's not supported by all browsers either.

H.264 最大的竞争对手是 Ogg Theora,但并非所有浏览器都支持它。

See http://en.wikipedia.org/wiki/HTML5_video#Browser_supportfor a table of H.264 and Ogg Theora support in major browsers.

请参阅http://en.wikipedia.org/wiki/HTML5_video#Browser_support以获取主要浏览器中的 H.264 和 Ogg Theora 支持表。

With Apple's decision to leave out Flash in the iPad, the issue of HTML5 video has flamed again, and a format war has begun between H.264 and Ogg Theora. John Gruberhas been writing extensively about the subject for the past week:

随着苹果决定在 iPad 中不使用 Flash,HTML5 视频的问题再次爆发,H.264 和 Ogg Theora 之间的格式大战已经开始。过去一周,约翰·格鲁伯 (John Gruber)一直在撰写有关该主题的大量文章:

回答by Michael Fuentes-Vasques-Wilson

The reason html5 videos work on the iPad, iPhone and iPod touch is because the video player itself is part of the code and does not require a separate program to run unlike flash videos which needs flash player installed, Which cannot be installed on apple mobile devices.

html5 视频在 iPad、iPhone 和 iPod touch 上工作的原因是因为视频播放器本身是代码的一部分,不需要单独的程序来运行,不像 Flash 视频需要安装 Flash 播放器,而不能安装在苹果移动设备上.

回答by Niike2

H.264 codec right now...

现在的 H.264 编解码器...