在< video>视频>中,没有在Firefox上播放的MP4视频标签,如果直接打开播放 [英] MP4 video not playing on Firefox in the <video> tag, plays if directly opened

查看:390
本文介绍了在< video>视频>中,没有在Firefox上播放的MP4视频标签,如果直接打开播放的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经使用了一个简单的 < video>< / code>标记来播放视频,并且适用于Firefox,Chrome和Internet Explorer。 然而,对于某些未知的因为我的服务器在几个月前开始锁定,所以我决定重新安装操作系统。我已经从硬盘上挽回了以前的安装,并且已经(在可能的情况下)重新使用了各种组件的配置文件。 b
$ b

一切正常,除了现在Firefox在使用< video> 时拒绝播放MP4视频,标记,只显示没有支持格式和MIME类型的视频消息。 Chrome浏览器(最新版本)(最新版本:Firefox浏览器中的 Viev video )可以正常播放。

版本)和Internet Explorer(最新的W7版本,不知道确切的数字是什么)正常工作。



由于我没有改变浏览器,但只有服务器软件/配置,我怀疑这个问题只存在于服务器上。

我已经搜索过了,我发现了一些建议,比如将正确的MIME添加到Apache .htaccess文件和检查标题可能的迹象。我已经按照每一个似乎值得追随的想法,对视频进行重新编码,但没有任何工作。



更多的事实:



这是当试图从视频标签播放文件时,服务器返回的头文件:

  Accept-Ranges:bytes 
连接:Keep-Alive
Content-Length:17709423
Content-Range:bytes 0-17709422 / 17709423
Content-Type:video / mp4
Date:F ri,18 Dec 2015 15:00:20 GMT
Etag:20081-10e394f-5272d4fd62880; 17709423
Keep-Alive:timeout = 5,max = 99
Last-Modified:Fri ,18 Dec 2015 14:54:10 GMT
服务器:Apache / 2.2.22(Debian)
X-Mod-H264-Streaming:version = 2.2.7


这是服务器在尝试直接播放文件(通过访问它的URL)时返回的标题:

 接受范围:字节
连接:保持活动
Content-Length:17709423
Content-Type:video / mp4
日期:2015年12月18日星期五15:45:00 GMT
Etag:20081-10e394f-5272d4fd62880; 17709423
Keep-Alive:timeout = 5,max = 100
最后修改:2015年12月18日星期五14:54:10 GMT
服务器:Apache / 2.2.22(Debian)
X-Mod-H264-Streaming:version = 2.2.7

我在这里没有看到任何重大区别。



此外,我发现一个较老的答案(从2012年12月),表明Firefox不会播放< vi deo> 标签由于一些版税问题,但由于视频用于播放和 HTML5视频示例播放就好,我怀疑这不再是这种情况。



我宁愿不重新 - 编码我的视频,考虑到他们在Firefox中工作得很好。

解决方案

Firefox告诉你错误中的问题消息在控制台中。它是3GP格式,而不是MP4: b
$ b


不支持video / 3gpp的HTTPContent-Type。加载媒体资源... recording.mp4失败。

您可以使用ffprobe来证实这一点。

 元数据:
major_brand:isom
minor_version:0
compatible_brands:isom3gp4
creation_time:2015-12-18 14:54:58
location:+ 44.4413 + 026.0771 /
location-eng:+ 44.4413 + 026.0771 /
时间: 00:00:08.22,开始:0.000000,比特率:17235kb / s
流#0:0(eng):视频:h264(高)(avc1 / 0x31637661),yuv420p,1920x1080,17106kb / s, 30.05 fps,30 tbr,90k tbn,180k tbc(默认)
元数据:
creation_time:2015-12-18 14:54:58
处理程序名称:VideoHandle
流#0 :1(eng):音频:aac(LC)(mp4a / 0x6134706D),48000 Hz,立体声,fltp,123 kb / s(默认)
元数据:
creation_time:2015-12-18 14 :54:58
handler_name:SoundHandle

重要的部分是 compatible_brands:isom3gp4 。 3GP是一种类似于MP4的文件格式,它们都基于 ISO基本媒体格式,但是他们不一样。可以同时播放的浏览器和应用程序可能不介意该文件不是内容类型标头中指定的格式。


$ b $ p em Firefox可能已经能够播放这些文件,直到版本41,基于其他提到我已经看到相同的错误,显然是在更新之前播放的文件。所以我敢打赌,这是变化,而不是你的服务器上的东西。

将视频和音频转换成MP4容器导致一个可播放的文件(尽管高比特率和 high h.264个人资料并不适合网络传送,但情况则完全不同)

  ffmpeg -i recording.mp4 -codec copy output.mp4 

方式,我不会采取什么浏览器时,直接打开文件作为代表什么将在视频元素在同一个浏览器中。他们经常表现不同。

I have a small home server that hosts several items, among them a few MP4 sample videos.

I've been using a simple <video> tag to play the videos, and it worked well for for Firefox, Chrome and Internet Explorer.

However, for some unknown reason my server started locking up a few months back, so I have decided to reinstall the OS. I have salvaged the previous installation from the hard drive and I have re-used (where possible) the configuration files for various components.

Everything worked just fine, Except that now Firefox refuses to play the MP4 videos when using the <video> tag, showing only the No video with supported format and MIME type found message. Opening the file directly (Viev video in Firefox) works, as the video get played correctly.

Chrome (latest version) and Internet Explorer (latest W7 version, not sure what the exact number is) are working just fine.

Since I have not changed the browser, but only the server software/configuration, I suspect that the issue lies solely on the server.

I have searched around, and I have found several suggestions, like adding the correct mime to the Apache's .htaccess files and checking the headers for possible indications. I have followed every idea that seemed worth following, short of re-encoding the video, but none worked.

More facts:

  • I am using the same browser and machine that played the videos before the crash to try and play the videos now.
  • This video plays just fine, and I don't see any difference between it and mine.
  • Here is a sample video from my machine: http://silviu.audiozone.ro (slash) recording.html - please excuse the poor obfuscation that I have used.

This is the header returned by the server when attempting to play the file from the video tag:

Accept-Ranges: bytes
Connection: Keep-Alive
Content-Length: 17709423
Content-Range: bytes 0-17709422/17709423
Content-Type: video/mp4
Date: Fri, 18 Dec 2015 15:00:20 GMT
Etag: "20081-10e394f-5272d4fd62880;17709423"
Keep-Alive: timeout=5, max=99
Last-Modified: Fri, 18 Dec 2015 14:54:10 GMT
Server: Apache/2.2.22 (Debian)
X-Mod-H264-Streaming: version=2.2.7

This is the header returned by the server when attempting play the file directly (by accessing it's URL):

Accept-Ranges: bytes
Connection: Keep-Alive
Content-Length: 17709423
Content-Type: video/mp4
Date: Fri, 18 Dec 2015 15:45:00 GMT
Etag: "20081-10e394f-5272d4fd62880;17709423"
Keep-Alive: timeout=5, max=100
Last-Modified: Fri, 18 Dec 2015 14:54:10 GMT
Server: Apache/2.2.22 (Debian)
X-Mod-H264-Streaming: version=2.2.7

I don't see any major differences here.

Furthermore, I have found an older answer (from December 2012) that indicated that Firefox does not play MP4 files in the <video> tag due to some royalties issue, but since the videos used to play and the HTML5 video sample plays just fine, I suspect this is no longer the case.

I'd rather not re-encode my videos, considering that they worked just fine in Firefox in the past.

解决方案

Firefox tells you the problem in the error message in the console. It's 3GP format rather than MP4:

HTTP "Content-Type" of "video/3gpp" is not supported. Load of media resource ...recording.mp4 failed.

You can corroborate that with ffprobe. I've truncated the output.

  Metadata:
    major_brand     : isom
    minor_version   : 0
    compatible_brands: isom3gp4
    creation_time   : 2015-12-18 14:54:58
    location        : +44.4413+026.0771/
    location-eng    : +44.4413+026.0771/
  Duration: 00:00:08.22, start: 0.000000, bitrate: 17235 kb/s
    Stream #0:0(eng): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 1920x1080, 17106 kb/s, 30.05 fps, 30 tbr, 90k tbn, 180k tbc (default)
    Metadata:
      creation_time   : 2015-12-18 14:54:58
      handler_name    : VideoHandle
    Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 123 kb/s (default)
    Metadata:
      creation_time   : 2015-12-18 14:54:58
      handler_name    : SoundHandle

The important part is compatible_brands: isom3gp4. 3GP is a similar file format to MP4 in that they are both based on the ISO base media format but they're not the same. Browsers and applications that can play both might not mind that the file isn't the format specified in the content type header.

I think Firefox may have been able to play these files until version 41, based on other mentions I've seen of the same error with files which apparently were playing before it updated. So I'd bet that's the change rather than something on your server.

Transmuxing the video and audio into an MP4 container results in a playable file (albeit the high bitrate and high h.264 profile aren't ideal for web delivery, but that's a different story).

ffmpeg -i recording.mp4 -codec copy output.mp4

By the way, I wouldn't take what a browser plays when you open the file directly as representative of what will in a video element in the same browser. They often behave differently.

这篇关于在&lt; video&gt;视频&gt;中,没有在Firefox上播放的MP4视频标签,如果直接打开播放的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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