不支持视频格式或MIME类型 [英] Video format or MIME type is not supported

查看:3327
本文介绍了不支持视频格式或MIME类型的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是运行视频的相关代码:

 < video id =videosrc =videos / clip .mp4type ='video / mp4'controls ='controls'> 
您的brwoser似乎不支持视频标签
< / video>

此代码分开工作,但尝试淡入时:

  function showVideoPlayer(){
console.log('video displayed');
$(#video)。fadeIn('medium');
}

它似乎不工作,我得到这个:





如您所见:不支持视频格式或MIME类型。



容器隐藏在css中:

  #video {
position:fixed;
border:solid 1px#000000;
width:654px;
height:454px;
background-color:#FFFFFF;
left:23%;
top:11%;
display:none;
}

这是想法,视频容器是隐藏的> display:none ),当需要时,我调用 showVideoPlayer 函数显示视频容器。但是,这不工作,并产生在 FireFox 中出现此错误,并在Chrome和IE9中出现空白屏幕。



我错过了什么?是 fadeIn 函数似乎让我错了?

解决方案

由于与格式的封闭源性质的哲学分歧,此时不支持MPEG H.264(mp4)格式。



要全部播放视频浏览器而不使用插件,您将需要以不同的格式托管每个视频的多个副本。您还需要使用视频标签的替代形式,如上面的@TimHayes的JSFiddle中所示,如下所示。 Mozilla声称只有mp4和WebM才能确保所有主要浏览器的完整覆盖,不过您可以参考 W3C的HTML5视频页,以查看哪个浏览器支持什么格式。



此外,值得检查 Wikipedia上的HTML5视频页 ,以便对主要文件格式进行基本比较。



下面是相应的视频标记(您需要在 WebM 中重新编码您的视频, a>或 OGG 格式以及您现有的mp4):

 < video id =videocontrols ='controls'> 
< source src =videos / clip.mp4type =video / mp4/>
< source src =videos / clip.webmtype =video / webm/>
< source src =videos / clip.ogvtype =video / ogg/>
您的浏览器似乎不支持视频标签。
< / video>

2013年11月8日更新

网络基础设施巨头Cisco已宣布计划开放,源代码实现了H.264编解码器,消除了迄今为止被Mozilla使用的许可费。没有太深入其政治(见下面的链接)这将允许Firefox支持H.264从2014年初开始。但是,正如该链接中所指出的,这仍然带有一个警告。 H.264编解码器仅用于视频,在MPEG-4容器中,它通常与闭源AAC音频编解码器配对。因此,H.264视频的播放将工作,但音频将取决于最终用户是否已经在他们的机器上存在AAC编解码器。



长缺点是进展正在进行,但你仍然不能避免使用多个编码,而不使用插件。


This is the relevant code to run video:

<video id="video" src="videos/clip.mp4" type='video/mp4' controls='controls'>
    Your brwoser doesn't seems to support video tag
</video> 

This code work fine separately, but when trying to fade it in:

function showVideoPlayer(){          
    console.log('video displayed');      
    $("#video").fadeIn('medium');
}

it doesn't seems to work and i got this:

As you can see: Video format or MIME type is not supported.

The video container is hidden in css:

#video{
    position:fixed;
    border:solid 1px #000000;
    width:654px;
    height:454px;
    background-color:#FFFFFF;
    left:23%;
    top:11%;
    display:none;
}

This is the idea, the video container is hidden (display:none), when needed, i call the function showVideoPlayer to show the video container. However that doesn't work and produce me this error in FireFox and a blank screen in Chrome and IE9.

Am i missing something? is the fadeIn function seems to get me wrong?

解决方案

Firefox does not support the MPEG H.264 (mp4) format at this time, due to a philosophical disagreement with the closed-source nature of the format.

To play videos in all browsers without using plugins, you will need to host multiple copies of each video, in different formats. You will also need to use an alternate form of the video tag, as seen in the JSFiddle from @TimHayes above, reproduced below. Mozilla claims that only mp4 and WebM are necessary to ensure complete coverage of all major browsers, but you may wish to consult the Video Formats and Browser Support heading on W3C's HTML5 Video page to see which browser supports what formats.

Additionally, it's worth checking out the HTML5 Video page on Wikipedia for a basic comparison of the major file formats.

Below is the appropriate video tag (you will need to re-encode your video in WebM or OGG formats as well as your existing mp4):

<video id="video" controls='controls'>
  <source src="videos/clip.mp4" type="video/mp4"/>
  <source src="videos/clip.webm" type="video/webm"/>
  <source src="videos/clip.ogv" type="video/ogg"/>
  Your browser doesn't seem to support the video tag.
</video>

Updated Nov. 8, 2013

Network infrastructure giant Cisco has announced plans to open-source an implementation of the H.264 codec, removing the licensing fees that have so far proved a barrier to use by Mozilla. Without getting too deep into the politics of it (see following link for that) this will allow Firefox to support H.264 starting in "early 2014". However, as noted in that link, this still comes with a caveat. The H.264 codec is merely for video, and in the MPEG-4 container it is most commonly paired with the closed-source AAC audio codec. Because of this, playback of H.264 video will work, but audio will depend on whether the end-user has the AAC codec already present on their machine.

The long and short of this is that progress is being made, but you still can't avoid using multiple encodings without using a plugin.

这篇关于不支持视频格式或MIME类型的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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