HTML 5视频标签可以使用不同的编解码器制作多个MP4资源吗? [英] Can a HTML 5 video tag have multiple MP4 sources with different codecs?

查看:179
本文介绍了HTML 5视频标签可以使用不同的编解码器制作多个MP4资源吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在考虑一个事实,即我们的MP4配置文件越高,视频质量越好......

这让我想到了一个问题I以为我会问专家!

HTML 5视频标签可以有多个不同编解码器的MP4资源吗?例如:

 < video> 
< source src =video.webmtype ='video / webm; codecs =vp8,vorbis'/>
< source src =high.mp4type ='video / mp4; codecs =avc1.64001E,mp4a.40.2'/>
< source src =main.mp4type ='video / mp4; codecs =avc1.4D401E,mp4a.40.2'/>
< source src =baseline.mp4type ='video / mp4; codecs =avc1.58A01E,mp4a.40.2'/>
< / video>

第一个MP4视频是高配置视频,第二个主要配置文件和第三个基准配置文件。

在iPhone 3G上,基准线会被播放吗?在iPhone 4S上,一个会被播放吗?



后续问题:如果高配置视频低于源列表中的基准配置文件视频,哪一个会在iPhone 4G上播放?



(感谢阅读,特别是如果您回复。:) p> 根据Mozilla < video> 可以包含任意数量的< source> 标签。此外,应该播放当前设备/浏览器兼容视频文件的第一个源标签。 b

Apple自己确认 < source> 标签应该在开发者的首选贯穿顺序中,我假设移动Safari也会选择它可以播放的第一个文件。



因此,从我能够挖掘出来的情况来看,没有一种静态的方式来选择特定浏览器/设备组合的特定文件。您可能必须根据提供的用户代理字符串进行一些检测,并仅提供适当的文件(但这对于纯HTML是不可能的)。


I'm thinking about the fact that the higher the MP4 profile we go, the better the video quality gets...

This brings me to a question I thought I'd ask the experts!

Can a HTML 5 video tag have multiple MP4 sources with different codecs? Something like:

<video>
    <source src="video.webm" type='video/webm; codecs="vp8, vorbis"' />
    <source src="high.mp4" type='video/mp4; codecs="avc1.64001E, mp4a.40.2"' />
    <source src="main.mp4" type='video/mp4; codecs="avc1.4D401E, mp4a.40.2"' />
    <source src="baseline.mp4" type='video/mp4; codecs="avc1.58A01E, mp4a.40.2"' />
</video>

The first MP4 video being a high profile video, the second main profile, and the third baseline profile.

On an iPhone 3G, will the baseline one be played?

On an iPhone 4S, will the high one be played instead?

A follow up question: if the high profile video is below the baseline profile video in the source list, which one will play on an iPhone 4G?

(Thanks for reading and especially if you reply. :)

解决方案

According to Mozilla, <video> can contain an arbitrary number of <source> tags. Also, the first source tag with a compatible video file for the current device/browser should be played.

Apple themselves confirm that the <source> tags should be in the developer's preferred fall-through order, from which I'd assume that Mobile Safari, too, will pick the first file it can play.

So, from what I was able to dig up, there is no static way of preferring a particular file for a particular browser/device combination. You'd probably have to do some detection based on the provided User Agent string and only supply the proper files (but that's not possible with plain HTML).

这篇关于HTML 5视频标签可以使用不同的编解码器制作多个MP4资源吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆