Do I need both WebM and ogv formats when using HTML5 video?
Asked Answered
G

3

34

From videojs.com's documentation, I had the impression that I needed to include both ogv and webm file formats (in addition to mp4).

Then I read http://www.htmlgoodies.com/html5/client/how-to-embed-video-using-html5.html#fbid=erNepglDbZl, from which it seems I just need mp4 and (ogv or webm).

What is correct? Do I need all three?

Gottuard answered 25/6, 2012 at 10:12 Comment(2)
These answers are outdated aren't they? I think mp4 is supported across the board now.. caniuse.com/#search=mp4Distinguishing
According to videojs' "troubleshooting" guide, "Most browsers now play MP4 with h264 video. If you want to have a single source, and neither live streaming nor adaptive streaming is a consideration, MP4 with h264 video and acc audio is a good choice.". I have no idea why they always include webm in their examples.Deflate
I
31

For those coming to this old question: only mp4 is required nowadays!

http://caniuse.com/#feat=mpeg4

Indemnify answered 9/1, 2017 at 13:2 Comment(5)
http://caniuse.com/#feat=mpeg4 Safari 9.5 DO support mp4 (and does not support ogv and webm)Beccafico
Did I say it wasn't?Indemnify
You did not said that but if you look at the caniuse page you linked (Desktop) Safari is reported to support mp4 from version 10, that is inaccurate since 9.5 supports it. (Or I am missing something...?)Beccafico
Ah I get what you mean now. You should report it to caniuse :)Indemnify
That's not true when other formats render same video quality with around 70% less file size than MP4, formats like WEBM and HEVC.Aeonian
H
17

As per Dive Into HTML5:

  • Firefox 3.5+, Opera 10.5+ and Chrome 3+ support ogv
  • Firefox 4+, Opera 10.6+ and Chrome 6+ support WebM (and ogv, assuming they don’t drop support in future)

So ogv is required for for:

  • Firefox 3.5 & 3.6
  • Opera 10.5
  • Chrome 3, 4, & 5

If you’re happy with those versions getting video via Flash (I presume that’s what VideoJS would do for them in the absence of an Ogg version), or no video at all if they don’t have Flash installed, then you don’t need the Ogg version.

Personally, I’d be very tempted to skip Ogg, just because converting video to three formats instead of two would (presumably) take 50% longer. I don’t have much experience with video though, so I don’t know what the pros and cons of each format are.

Hodeida answered 25/6, 2012 at 11:0 Comment(4)
Thank you Paul. Now it makes sense. Based on the marked penetration of those older browsers, I have the details need to find out whether i want to skip ogv or not.Gottuard
@nitech: you‘re very welcome. Note that users of these browsers may have Flash installed too, and thus see the video.Hodeida
Yes, I realize that. As you say, Videojs has a flash fallback. I haven't tested if it kicks in whenever one ogv or webm is missing, but I'd expect it to do so.Gottuard
Here is a table for cross browser video/audio support: developer.mozilla.org/en-US/docs/Web/HTML/…Merchantable
R
2

Check here not all browsers support all formats native (without additional plugins)

IE9 plays only MP4, firefox 4 WebM and OGV, Chrome plays all (but there are some rumours that they won t support MP4 for newer versions, if i m right), Safari plays MP4, Opera WebM and OGG

So if you check the codecs, you should either take MP4 and WebM or MP4 and OGG to match all current browser.

Rohrer answered 25/6, 2012 at 10:52 Comment(2)
This seems logically. But why do you think sites like videojs.com/docs/setup tell you to use both ogv and webm?Gottuard
@nitech: to support older versions of Firefox, Opera and Chrome. See my answer.Hodeida

© 2022 - 2024 — McMap. All rights reserved.