野生动物园不会播放转换为mp4或m4v的gif [英] safari won't play a gif converted to mp4 or m4v
问题描述
我将由三个图像组成的gif转换为mp4,也转换为m4v(对于Safari),以便在html5视频播放器中播放,但是,Safari既不会播放 .mp4
也不会播放 .m4v
和以下
< video preload ="yes" controls ="true">< source src ="./menu.mp4" type ="video/mp4"/>< source src ="./menu.m4v" type ="video/m4v"/></video>
但是,如果我使用正确的视频(即未转换的gif),那么Safari(9.2)将使用上述语法播放该视频,因此我知道html5视频播放器正在我的浏览器中运行,而不是我的转换后的gif.问题,对于转换为静止电影"照片的gif,我是否必须设置其他类型,即 type ="gif/m4v"
还是必须激活其他设置?/p>
我使用ffmpeg将gif转换为mp4,但不记得我运行该命令的确切命令.
更新根据此 TechCrunch文章,Twitter使用mp4而不是gif,因此我假设它应该在所有浏览器上都能正常工作.
可以在此处查看mp4文件
https://www.dropbox.com/s/mvkzo8xe7is4rle/menu.mp4?dl=0
问题是视频编码,特别是与视频编解码器一起使用的H.264配置文件设置.
您当前的视频编码为: High 4:4:4 Predictive @ Level 2.2
对于浏览器视频来说似乎很不寻常(并且可能在某些移动设备上无法解码).
解决方案:
在编码器中,选择 Baseline
或 Main
的H.264配置文件.
此 有效的视频 使用 Main @ L3.1
使用 FFmpeg ,您可以在 Main
配置文件(适用于您的尺寸宽度480 X高度640 ).
ffmpeg -i input.mp4 -c:v libx264 -pix_fmt yuv420p -profile:v main -level:v 3.1 -an output.mp4
有用的注释:
-
您可以 >在此处检查 一些Apple推荐的配置文件(请参阅 Point.11 ).预计该视频将使用
4:2:0
采样,而不是在无效视频中出现问题的4:4:4
. -
However, if I use a proper video (i.e. not a converted gif) Safari (9.2) will play it using the above syntax, so I know the html5 video player is working in my browser, just not my converted gif. Question, for a gif that's converted to a "movie of still" photos, do I have to set a different type i.e.
type="gif/m4v"
or is there another setting I have to activate?I used ffmpeg to convert the gif to an mp4 but don't recall the exact command that I ran to do it.
Update According to this TechCrunch article, Twitter uses mp4s instead of gifs so I'm assuming it should work on all browsers.
the mp4 file can be viewed here
https://www.dropbox.com/s/mvkzo8xe7is4rle/menu.mp4?dl=0
解决方案The problem is the video encoding, specifically the H.264 Profile setting, used with video codec.
Your current video is encoded as :
High 4:4:4 Predictive @ Level 2.2
which seems unusual for a browser video (and possibly won't decode on some mobile devices).Solution :
In your encoder, choose an H.264 Profile of either
Baseline
orMain
.This working video uses
Main @ L3.1
Using FFmpeg you can produce a new video under
Main
profile (which is suitable for your dimensions width 480 X height 640).ffmpeg -i input.mp4 -c:v libx264 -pix_fmt yuv420p -profile:v main -level:v 3.1 -an output.mp4
Useful Notes :You can check here some Apple recommended profiles (see Point.11). It is expected the video is using
4:2:0
sampling, not the problematic4:4:4
in the not-working video.Wowza.com explains Profiles and Levels for mobile devices.
A
Baseline
Profile would guarantee playback on even older devices (eg: iPhone 3 or older).
这篇关于野生动物园不会播放转换为mp4或m4v的gif的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!