iPad不会用HTML5渲染H.264视频 [英] iPad Doesn't Render H.264 Video with HTML5

查看:180
本文介绍了iPad不会用HTML5渲染H.264视频的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一些H.264编码的视频在网络浏览器中正确呈现在HTML5中,但不能在iPad上正确渲染。当我使用从互联网下载的H.264视频时,我的视频在iPad上正确呈现,所以不是HTML问题。



这是ffmpeg信息关于我的视频 -



我原来的.mov视频:


1编解码器帧速率与容器帧速率不同:6000.00(6000/1) - > 30.00(30/1)



输入#0,mov,mp4,m4a,3gp ,3g2,mj2,来自'a_video.mp4':



元数据:

  major_brand:qt 
minor_version:537199360
compatible_brands:qt

持续时间:00:00:42.74,开始:0.000000,比特率:220 kb / s

 流#0.0(eng):音频:流量#0.1(eng):视频:h264,yuv420p,762x464,122 kb / s,30 fps,30 tbr,3k tbn,6k tbc 


使用Handbrake将.mov转换为mp4后,在t上渲染他的iPad:


似乎流0编解码器帧速率与容器帧速率不同:180000.00(180000/1) - > 29.97(30000/1001 )



从'a_video.m4v'输入#0,mov,mp4,m4a,3gp,3g2,mj2:



元数据:

  major_brand:mp42 
minor_version:0
compatible_brands:mp42isomavc1
编码器:HandBrake 0.9.5 2011010300

持续时间:00:00:42.77,开始:0.000000,比特率流量#0.0(und):视频:h264,yuv420p,752x464 [PAR 381:376 DAR 381:232],35 kb / s, PAR 145161:141376 DAR 145161:87232,29.97 fps,29.97 tbr,90k tbn,180k tbc

流#0.1(eng):音频:aac,44100 Hz,立体声,s16,128 kb / s


这是一个在线查找的.mp4,它在iPad上呈现:



< blockquote>

似乎流1编解码帧速率与容器帧速率不同:180000.00(180 000/1) - > 25.00(25/1)



从'a_video_3_emu.mp4'输入#0,mov,mp4,m4a,3gp,3g2,mj2:

元数据:
major_brand:M4VP

minor_version:1

compatible_brands:M4VPM4A mp42isom

编码器:CoreMediaAuthoring 677,CoreMedia 420.17,i386



持续时间:00:01:38.01,开始:0.000000,比特率:1023 kb / s



Stream#0.0(und):Audio:aac,32000 Hz,mono,s16,97 kb / s

Stream#0.1(und):Video:h264,yuv420p ,480x360 [PAR 1:1 DAR 4:3],914 kb / s,25 fps,25 tbr,90k tbn,180k tbc


有谁看到我的视频编码方式有问题吗?



修改



首先我的理论是iPad对不同的容器格式敏感,但似乎并非如此。我拍摄了一个在iPad上正确呈现的视频,并将其转换为.mov,并在iPad上正确播放它。所以iPad应该处理基本的H.264流,一定有问题。

解决方案

264视频流 - 无论容器(mov,m4v,mp4)如何 - 您的HTML5视频呈现在Web浏览器中,但不会在iPad上渲染,有两种可能的修复方法:



第一个解决方案是将H.264视频流转换为mpeg4。



ffmpeg -i video_h264_not_working.mov - acodec copy -vcodec mpeg4 video_mpeg.mov



(或者,您可以在Handbrake中选择MPEG4而不是H.264)。



第二个解决方案是使用以下参数重新处理H.264视频:



ffmpeg -i video_h264_not_working.mov -vcodec libx264 -r 25 -b 516k -bt 516k -crf 22 -vpre normal video_h264.mov



第二个解决方案来自: http:/ /houseoflaudanum.com/navigate/howtos/html5-video-no-webm/



我猜在前一种情况下,mpeg4编解码器更多在iPad上放松;而在后一种情况下,iPad不喜欢原始H.264编码的一些流参数,因此需要清理。



确定你的视频流实际上是什么,只要做ffmpeg -i myvideo.mov。


I have some H.264-encoded videos which render in HTML5 correctly in the web browser, but do not render correctly on the iPad. When I use a H.264 video I downloaded off the internet, my video renders correctly on the iPad, so it is not an HTML problem.

Here is the ffmpeg info about my videos --

My original .mov video:

Seems stream 1 codec frame rate differs from container frame rate: 6000.00 (6000/1) -> 30.00 (30/1)

Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'a_video.mp4':

Metadata:

major_brand     : qt  
minor_version   : 537199360
compatible_brands: qt  

Duration: 00:00:42.74, start: 0.000000, bitrate: 220 kb/s

Stream #0.0(eng): Audio: aac, 44100 Hz, stereo, s16, 94 kb/s
Stream #0.1(eng): Video: h264, yuv420p, 762x464, 122 kb/s, 30 fps, 30 tbr, 3k tbn, 6k tbc

After using Handbrake to convert my .mov to a mp4, yet doesn't render on the iPad:

Seems stream 0 codec frame rate differs from container frame rate: 180000.00 (180000/1) -> 29.97 (30000/1001)

Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'a_video.m4v':

Metadata:

major_brand     : mp42  
minor_version   : 0
compatible_brands: mp42isomavc1  
encoder: HandBrake 0.9.5 2011010300  

Duration: 00:00:42.77, start: 0.000000, bitrate: 169 kb/s

Stream #0.0(und): Video: h264, yuv420p, 752x464 [PAR 381:376 DAR 381:232], 35 kb/s, PAR 145161:141376 DAR 145161:87232, 29.97 fps, 29.97 tbr, 90k tbn, 180k tbc
Stream #0.1(eng): Audio: aac, 44100 Hz, stereo, s16, 128 kb/s

Here is a .mp4 I found online which does render on the iPad:

Seems stream 1 codec frame rate differs from container frame rate: 180000.00 (180000/1) -> 25.00 (25/1)

Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'a_video_3_emu.mp4':

Metadata: major_brand : M4VP
minor_version : 1
compatible_brands: M4VPM4A mp42isom
encoder : CoreMediaAuthoring 677, CoreMedia 420.17, i386

Duration: 00:01:38.01, start: 0.000000, bitrate: 1023 kb/s

Stream #0.0(und): Audio: aac, 32000 Hz, mono, s16, 97 kb/s
Stream #0.1(und): Video: h264, yuv420p, 480x360 [PAR 1:1 DAR 4:3], 914 kb/s, 25 fps, 25 tbr, 90k tbn, 180k tbc

Does anyone see something wrong with the way I am encoded my videos?

Edit

At first my theory was that the iPad was sensitive to different container formats; but that appears not to be the case. I took a video which does render correctly on the iPad and converted it to a .mov, and it still played correctly on the iPad. So there must be a problem with how the iPad deals with the underlying H.264 stream.

解决方案

If you have a H.264 video stream -- regardless of the container (mov, m4v, mp4) -- and your HTML5 video renders in a web browser but doesn't render on the iPad, there are two possible fixes:

The first solution is to convert the H.264 video stream to mpeg4.

ffmpeg -i video_h264_not_working.mov -acodec copy -vcodec mpeg4 video_mpeg.mov

(Alternatively, you can select MPEG4 instead of H.264 in Handbrake.)

The second solution is to re-process the H.264 video with the following parameters:

ffmpeg -i video_h264_not_working.mov -vcodec libx264 -r 25 -b 516k -bt 516k -crf 22 -vpre normal video_h264.mov

The second solution came from: http://houseoflaudanum.com/navigate/howtos/html5-video-no-webm/

I'm guessing in the former case, the mpeg4 codec is more relaxed on the iPad; and in the latter case, the iPad didn't like some of the stream parameters from the original H.264 encoding, so a "cleaning" was necessary.

To determine what your video stream actually is, just do ffmpeg -i myvideo.mov.

这篇关于iPad不会用HTML5渲染H.264视频的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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