简体   繁体   English

ffmpeg-mp4可以在野生动物园中播放,除非它不是第一个来源? Chrome无法播放相同的mp4吗?

[英]ffmpeg - mp4 plays in safari unless it is not the first source? Chrome wont play same mp4?

Yet another issue trying to get html5 video working. 另一个尝试使html5视频正常工作的问题。

I have created 3 versions of the same video in 3 different formats using ffmpeg: mp4, ogg, and webm. 我使用ffmpeg创建了3种不同格式的同一视频的3个版本:mp4,ogg和webm。

The .ogg plays fine in chrome when listed as the first html5 video source, and the .mp4 plays fine in safari when listed as the first html5 video source, however, if I list the .mp4 source above the .ogg source, chrome will no longer load/play the .ogg video as it is defaulting to the .mp4 video which will not play , and in the same fashion, if I list the .ogg source file above the .mp4 source file, safari will not load the .mp4 video. 当列为第一个html5视频源时,.ogg在chrome中播放正常,而当列为第一个html5视频源时,.mp4在safari中播放正常,但是,如果我在.ogg源上方列出.mp4源,则chrome不再加载/播放.ogg视频,因为它默认是不会播放的.mp4视频,并且以同样的方式,如果我在.mp4源文件上方列出.ogg源文件,则safari将不会加载.ogg视频。 mp4视频。

I am at a loss. 我很茫然。 Here is my embed code: 这是我的嵌入代码:

<video width="100%" height="100%">
    <source src="./videos/Wildlife.ogg">
    <source src="./videos/Wildlife.webm">
    <source src="./videos/Wildlife.mp4">
</video>

Any ideas as to why the fallbacks between sources are is not working properly? 关于为什么源之间的后备无法正常工作的任何想法?

Why isn't safari obeying the fallback order and ignoring the .ogg/.webm files? 野生动物园为何不遵循后备顺序而忽略.ogg / .webm文件?

After quite a bit of troubleshooting, and adding/removing tags, I finally got the fallbacks to work properly by listing their types. 经过大量的故障排除和添加/删除标记后,我终于通过列出它们的类型使后备功能正常工作。

<video width="100%" height="100%">
    <source src="./videos/Wildlife.ogg" type="video/ogg">
    <source src="./videos/Wildlife.webm" type="video/webm">
    <source src="./videos/Wildlife.mp4" type="video/mp4">
</video>

In other words, in my case, the browsers would not fallback to the next available (playable) video format unless I added the 'type=' attributes on each video type. 换句话说,就我而言,除非我在每种视频类型上添加了“ type =”属性,否则浏览器不会回退到下一个可用的(可播放的)视频格式。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM