HTML5 video codec support

后端 未结 5 1351
一整个雨季
一整个雨季 2021-02-05 14:10

What codecs will be supported with the HTML5 video tag?

Will it vary by browser, or is there a spec of specific codec that will be supported?

5条回答
  •  天命终不由人
    2021-02-05 14:39

    The spec does not mandate specific codecs.

    For a long time, there was a strong divide between browser vendors. Firefox would not implement H.264 due to patent issues. Apple would not implement Ogg Theora due to concerns about lack of hardware implementation and bandwidth issues, as well as some vague concerns about submarine patents. Google said that they wouldn't encode YouTube video in Ogg Theora, due to quality and bandwidth concerns, though they implemented both H.264 and Ogg Theora in Chrome. I believe that Opera also was concerned about H.264 patents, and Microsoft was in favor of H.264 and against Theora.

    Then Google bought On2, and created WebM, a specification including VP8 video and Ogg Vorbis audio in a Matroska container. Firefox, Chrome, and Opera all committed to supporting WebM. Microsoft and Apple have not yet embraced it, though Microsoft has said they will support VP8 video "when the user has installed a VP8 codec." This sounds like a situation similar to that of Safari; you can install QuickTime plugins to support other codecs, like Ogg Theora or VP8/WebM, but it doesn't support it out of the box.

    The real question here is what people will support on mobile hardware. Because there is special purpose hardware to accelerate decoding, patents become much more of an issue, and due to limited resources, just supporting a long list of codecs becomes a lot less feasible. Google has promised to support WebM in Android 3, which is due by the end of this year, but I wouldn't bet on Apple or Microsoft implementing it any time soon.

    The likely answer is that there won'e be one standard codec for a while. The best approach to get video that will play everywhere would be to encode in Ogg Theora and H.264, and use two elements to refer to them. As browsers increasingly support WebM (Firefox 4, Chrome 6), you will likely want to transition to encoding in both H.264 and WebM. You could start encoding in all 3 now, but that's a bit redundant as most browsers which support WebM also support Ogg Theora.

提交回复
热议问题