MP4视频无法在平板电脑/手机上播放 [英] MP4 video unable to play on tablet/mobile

查看:746
本文介绍了MP4视频无法在平板电脑/手机上播放的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有可能在iPad上播放MP4视频?我为客户创建了一个网站,在头版上有一个预告视频。我用HTML5标签 video 完成了这个,如下所示:

Is there a possibility to play a MP4 video on iPad? I created a website for a client, with a teaser video on the front-page. I have done this with the HTML5 tag video, like so:

<video autoplay loop muted>
    <source src="video/teasermauricedraait.webm" type="video/webm">
    <source src="video/teasermauricedraait.mp4" type="video/mp4">
</video>

以上代码在桌面上起作用,但在平板电脑(iPad)和移动设备(iPhone)上视频未显示。

Above code is working as aspect on desktop, but on tablet (iPad) and mobile (iPhone) the video isn't displayed.

还尝试添加另一行源代码,但这不能解决问题:
< source src =video / teasermauricedraait.movtype =video / mov>

Tried also to add another line of source code, but this doesn't fix the issue: <source src="video/teasermauricedraait.mov" type="video/mov">

我做错了什么?

推荐答案

MP4是视频和音频流的容器规范,容器中的视频和音频可能使用不同的编码。

MP4 is a 'container' specification for video and audio steams and the videos and audios in the container may use different encodings.

iPAD支持的子集在此定义:
- https://developer.apple.com/library/ios/documentation/Miscellaneous/Conceptual/iPhoneOSTechOverview/MediaLayer/MediaLayer.html

The subset that is supported on an iPAD is definined here: - https://developer.apple.com/library/ios/documentation/Miscellaneous/Conceptual/iPhoneOSTechOverview/MediaLayer/MediaLayer.html

相关摘录是:


iOS支持许多行业标准视频格式和压缩标准,包括:

iOS supports many industry-standard video formats and compression standards, including the following:


  • H.264视频,高达1.5 Mbps,640 x 480像素,每秒30帧,H.264基线配置文件的低复杂度版本,AAC-LC音频高达160 Kbps,48 kHz,立体声音频,.m4v,.mp4和.mov文件格式

  • H.264视频,高达768 Kbps,320 x 240像素,每秒30帧,基线配置文件高达1.3级,AAC-LC音频高达160 Kbps ,48 kHz,.m4v,.mp4和.mov文件格式的立体声音频

  • MPEG-4视频,最高2.5 Mbps,640 x 480像素,每秒30帧,简单具有AAC-LC音频的配置文件,最高160 Kbps,48 kHz,立体声音频,.m4v,.mp4和.mov文件格式

  • 多种音频格式,包括音频技术中列出的格式

  • H.264 video, up to 1.5 Mbps, 640 by 480 pixels, 30 frames per second, Low-Complexity version of the H.264 Baseline Profile with AAC-LC audio up to 160 Kbps, 48 kHz, stereo audio in .m4v, .mp4, and .mov file formats
  • H.264 video, up to 768 Kbps, 320 by 240 pixels, 30 frames per second, Baseline Profile up to Level 1.3 with AAC-LC audio up to 160 Kbps, 48 kHz, stereo audio in .m4v, .mp4, and .mov file formats
  • MPEG-4 video, up to 2.5 Mbps, 640 by 480 pixels, 30 frames per second, Simple Profile with AAC-LC audio up to 160 Kbps, 48 kHz, stereo audio in .m4v, .mp4, and .mov file formats
  • Numerous audio formats, including the ones listed in Audio Technologies

您的情况稍微复杂一点,因为视频位于设备上的浏览器中 - 您可能不希望这种情况自动在移动设备上播放,因为某些价格计划可能会为您的用户带来数据成本 - 这是在历史上不支持在移动设备上自动播放视频的关键原因。人们尝试过各种各样的解决方法,但我不确定是否有一种普遍适用的解决方法,你真的需要考虑你是否真的想要这样做。

Your case is slightly more complicated in that the video is in a browser on the device - you may not want this automatically to play on a Mobile device as with some price plans you may be running up data costs for your users - this is a key reason auto play of videos on mobile devices is not historically supported. There are various workaround people have tried but I'm not sure there is one that works universally, and you really need to think about whether you actually want to do this.

如果视频根本无法播放,即使用户点击播放,那么导致视频在浏览器中播放但在iOS设备(尤其是较旧设备)上播放的常见问题是h.264视频的配置文件 - 您可以在上面看到支持基线。

If the video will not play at all, even when the user clicks play then a common problem which can cause a video to play fine in a browser but not on an iOS device (especially older ones) is the profile of the h.264 video - you can see above that 'baseline' is supported.

可以使用ffprobe等工具检查( https://www.ffmpeg.org/ffprobe.html )如果您熟悉它。如果没有,您可以在评论中发布视频链接,其他人可以为您查看。

This can be checked with tools like ffprobe (https://www.ffmpeg.org/ffprobe.html) if you are familiar with it. If not and you are able to post a link to your video in the comments here others can check for you.

这篇关于MP4视频无法在平板电脑/手机上播放的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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