Safari - 视频加载太慢 [英] Safari - Videos load far too slowly

查看:65
本文介绍了Safari - 视频加载太慢的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在将视频植入我的网站时遇到了一些麻烦.

I am having a bit of trouble implementing a video into my site.

我使用这段代码:

<video id="video-background" poster="/video/video-poster.jpg" autoplay loop muted playsinline>
    <source src="/video/video.webm" type="video/webm">
    <source src="/video/video.mp4" type="video/mp4">
    <source src="/video/video.ogg" type="video/ogv">
</video>

在 Safari 以外的任何浏览器中打开时,视频会立即加载.我还没有看到播放时间超过 5 秒.

When opened in any browser other than Safari the video loads instantly. I haven't seen it take longer than 5 seconds before it is playing.

在 Safari 中打开时,视频需要将近一分钟才能开始播放(甚至可能更长).

When opened in Safari the video takes close to a minute to begin playing (might even be longer).

任何人都可以为这种疯狂添加一些理由,以便我可以:1) 提高 Safari 的性能...2) 给我的经理找个好借口...

Can anyone add some reason to this madness so I can: 1) Improve performance on Safari... 2) Get a good excuse to my manager...

我检查了所有视频声明 - 它们都是工作视频.我已尝试移动声明视频的顺序.

I have checked all the video declarations - they are all are working videos. I have tried moving the order that the videos are declared.

谢谢,杰森.

推荐答案

我的假设是视频具有默认编码 - 通常对于 mp4 视频,最后一步是编写 MOOV atom最后包含有关帧位置等的元数据和信息.这意味着在文件被完全读取之前,浏览器无法获得所有可用信息.

My assumption would be that the video has default encoding - usually with an mp4 video the final step is to write the MOOV atom that contains the metadata and information about the frame locations etc at the end. This means until the file has been completely read the browser doesn't have all the information available to it.

您可以使用 FFMPEG(开源、免费、可下载适用于大多数平台)并进行第二次修复来解决此问题在视频上将 MOOV atom 移到前面:

You can fix this using FFMPEG (open source, free, downloads available for most platforms) and doing a second pass on the video to move the MOOV atom to the front:

./ffmpeg -y -i source.mp4 -movflags faststart dest.mp4

这篇关于Safari - 视频加载太慢的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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