在 iPhone 3GS 与 iPhone 4 上为 Mobile Safari 嵌入 HTML5 视频

发布于 2024-11-02 22:22:58 字数 531 浏览 1 评论 0原文

我在服务器上的 mp4 文件中有 H.264/AAC 编码的视频,mime 类型的视频/mp4 添加到 Web 服务器 (IIS 7),并且我有一个带有视频标签的页面:

<video id="html5-video" width="360" height="202" poster="/images/poster.png" controls>
    <source src="/video/Web-360x202-14MB.mp4" type="video/mp4">
</video>

在iPhone 4,但在 iPhone 3GS(相同的 iOS 版本,4.3.2)上仅显示海报图像,点击它不会启动视频。

当我尝试直接打开视频文件时,我从 Mobile Safari 开发者控制台收到“提示”:

其他提示

QuickTime

电影无法播放

要使 HTML5 视频在 iPhone 3GS 上运行需要什么?是编码问题吗?

I have an H.264/AAC encoded video in an mp4 file on the server, the mime-type video/mp4 is added to the web server (IIS 7), and I have a page with a video tag:

<video id="html5-video" width="360" height="202" poster="/images/poster.png" controls>
    <source src="/video/Web-360x202-14MB.mp4" type="video/mp4">
</video>

Works great on an iPhone 4, but on an iPhone 3GS (same iOS version, 4.3.2) is only shows the poster image and tapping it doesn't start the video.

When I try to open the video file directly, I get a 'tip' from the Mobile Safari developer console:

Other Tip

QuickTime

Movie could not be played

What is needed to get HTML5 video working on an iPhone 3GS? Is it an encoding issue?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

多情癖 2024-11-09 22:22:58

我遇到过同样的问题,是的,这似乎是一个编码问题。我遵循此处提供的通用智能手机配置文件:

默认值:

视频:H.264,3.0 级,基线配置文件音频:AAC,1-2 通道

播放时间:

iOS:iPhone、iPad、Apple TV、iPod Touch、iPod Classic、iPod 5.5G
黑莓:Bold 9000、Curve 8910、8900、8520、Pearl 9XXX、Storm、
Storm 2、Torch、Tour、Bold 9650 + 9700 Android:全部(?)其他:PSP
(3.30+)、PS3、Xbox 360、网络

无法播放:

iPod 5G、PSP(3.30 之前)、Blackberry Curve 9330、9300、8530、83XX、
珍珠8XXX、88XX

设置:

默认值,加上:

audio_bitrate:128(或更少)audio_sample_rate:44100(或更少)大小:
480×320 max_frame_rate: 30 video_bitrate: 1500(或更少)

http://blog.zencoder.com/2010/09/30/how-to-encode-video-for-mobile-use/

它解决了问题。我的 mp4 文件现在可以在 iPhone 3gs 和 4 上读取。

I've experienced the same issue and yes it seems that it's an encoding issue. I followed the Universal Smartphone profile provided here :

Defaults:

Video: H.264, Level 3.0, Baseline profile Audio: AAC, 1-2 channels

Plays on:

iOS: iPhone, iPad, Apple TV, iPod Touch, iPod Classic, iPod 5.5G
Blackberry: Bold 9000, Curve 8910, 8900, 8520, Pearl 9XXX, Storm,
Storm 2, Torch, Tour, Bold 9650 + 9700 Android: All (?) Other: PSP
(3.30+), PS3, Xbox 360, web

Doesn’t play on:

iPod 5G, PSP (pre-3.30), Blackberry Curve 9330, 9300, 8530, 83XX,
Pearl 8XXX, 88XX

Settings:

Defaults, plus:

audio_bitrate: 128 (or less) audio_sample_rate: 44100 (or less) size:
480×320 max_frame_rate: 30 video_bitrate: 1500 (or less)

http://blog.zencoder.com/2010/09/30/how-to-encode-video-for-mobile-use/

and it solved the problem. My mp4 file can now be read both on iPhone 3gs and 4.

彡翼 2024-11-09 22:22:58

出现此符号

在此处输入图像描述

如果您的 HTML 元素 iPhone 3GS 或 iPhone 4 这是因为这些手机将播放 HTML 视频,如果:

  • 有一个 是使用 MPEG-4 H.264 编码的 MP4视频电平3 基线配置文件 + AAC 音频
  • 分辨率不超过特定手机的限制(请参阅下面的规格)

我在 Miro Video Converter 上尝试了 iPhone 配置文件,但它不起作用。我发现可以转换为这种格式的最简单的转码器是 HandBrake。只需使用 iPod 预设进行转码即可支持 3GS 和 iPhone & 3GS。 iPod 预设为支持更高分辨率的 iPod 4+。

Apple 的 iPhone 4 规格

支持的视频格式:H.264 视频高达 720p,每秒 30 帧,
Main Profile 级别 3.1,AAC-LC 音频高达 160 Kbps、48kHz、立体声
.m4v、.mp4 和 .mov 文件格式的音频; MPEG-4 视频,最高 2.5
Mbps、640 x 480 像素、每秒 30 帧、简单配置文件
AAC-LC 音频每通道高达 160 Kbps、48kHz、.m4v 立体声音频、
.mp4 和 .mov 文件格式;运动 JPEG (M-JPEG) 高达 35 Mbps, 1280
720 像素,每秒 30 帧,ulaw 音频,PCM 立体声音频
.avi 文件格式

https://support.apple.com/kb /SP587?viewlocale=en_US&locale=en_US

Apple 的 iPhone 3GS 规格

支持的视频格式:H.264 视频,高达 1.5 Mbps,640 x 480
像素,每秒 30 帧,H.264 的低复杂度版本
基线配置文件,AAC-LC 音频高达 160 Kbps、48kHz、立体声音频
.m4v、.mp4 和 .mov 文件格式; H.264 视频,高达 2.5 Mbps,640
480 像素,每秒 30 帧,基线配置文件高达 3.0 级
AAC-LC 音频高达每通道 160 Kbps、48kHz、立体声音频输入
.m4v、.mp4 和 .mov 文件格式; MPEG-4 视频,高达 2.5 Mbps,640
480 像素,每秒 30 帧,简单配置文件,带 AAC-LC 音频
.m4v、.mp4 和 .mov 文件中高达 160 Kbps、48kHz 的立体声音频
格式 通过 Apple Component AV 线支持 576p 和 480p; 576i
和 480i,配备 Apple Composite AV 线缆(线缆单独出售)

https:// support.apple.com/kb/SP565?viewlocale=en_US&locale=en_US

If you are getting this symbol

enter image description here

for your HTML <video> element on an iPhone 3GS or iPhone 4 it's because those phones will only play HTML videos if:

  • There is a <source> that is a MP4 encoded with MPEG-4 H.264 Video Level 3 Baseline Profile + AAC Audio
  • The resolution does not exceed the limit for the particular phone (see specs below)

I tried the iPhone profile on Miro Video Converter and it didn't work. The easiest transcoder I've found that will convert to this format is HandBrake. Just transcode using the iPod preset for 3GS support and iPhone & iPod preset for iPod 4+ support with higher resolution.

iPhone 4 specs from Apple:

Video formats supported: H.264 video up to 720p, 30 frames per second,
Main Profile level 3.1 with AAC-LC audio up to 160 Kbps, 48kHz, 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 per channel, 48kHz, stereo audio in .m4v,
.mp4, and .mov file formats; Motion JPEG (M-JPEG) up to 35 Mbps, 1280
by 720 pixels, 30 frames per second, audio in ulaw, PCM stereo audio
in .avi file format

https://support.apple.com/kb/SP587?viewlocale=en_US&locale=en_US

iPhone 3GS specs from Apple:

Video formats supported: 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, 48kHz, stereo audio
in .m4v, .mp4, and .mov file formats; H.264 video, up to 2.5 Mbps, 640
by 480 pixels, 30 frames per second, Baseline Profile up to Level 3.0
with AAC-LC audio up to 160 Kbps per channel, 48kHz, 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, 48kHz, stereo audio in .m4v, .mp4, and .mov file
formats Support for 576p and 480p with Apple Component AV Cable; 576i
and 480i with Apple Composite AV Cable (cables sold separately)

https://support.apple.com/kb/SP565?viewlocale=en_US&locale=en_US

也只是曾经 2024-11-09 22:22:58

我遇到了同样的问题,但所有这些修复都不起作用。最终起作用的是删除我对这些文件使用的 htaccess 保护。前面的答案是正确的,但这将解决任何 htaccess 安全问题。

AuthName "myusername"
AuthType Basic
AuthUserFile /Library/WebServer/.htpasswd

Require valid-user

<FilesMatch mp3>
Satisfy any 
order allow,deny 
allow from all 
</FilesMatch> 

<FilesMatch mp4>
Satisfy any
order allow,deny
allow from all
</FilesMatch>

<FilesMatch aac>
Satisfy any
order allow,deny
allow from all
</FilesMatch>

<FilesMatch m4v>
Satisfy any
order allow,deny
allow from all
</FilesMatch>

<FilesMatch m4b>
Satisfy any
order allow,deny
allow from all
</FilesMatch>

I was experiencing the same issue but all these fixes weren't working. What did work eventually was to remove the htaccess protection I was using for those files. The previous answer is right, but this will fix any htaccess security problems.

AuthName "myusername"
AuthType Basic
AuthUserFile /Library/WebServer/.htpasswd

Require valid-user

<FilesMatch mp3>
Satisfy any 
order allow,deny 
allow from all 
</FilesMatch> 

<FilesMatch mp4>
Satisfy any
order allow,deny
allow from all
</FilesMatch>

<FilesMatch aac>
Satisfy any
order allow,deny
allow from all
</FilesMatch>

<FilesMatch m4v>
Satisfy any
order allow,deny
allow from all
</FilesMatch>

<FilesMatch m4b>
Satisfy any
order allow,deny
allow from all
</FilesMatch>
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文