33

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?

Paul D. Waite
  • 96,640
  • 56
  • 199
  • 270
nitech
  • 1,822
  • 3
  • 21
  • 35
  • 3
    These answers are outdated aren't they? I think mp4 is supported across the board now.. http://caniuse.com/#search=mp4 – Costa Michailidis May 02 '16 at 02:37
  • According to [videojs' "troubleshooting" guide](https://docs.videojs.com/tutorial-troubleshooting.html), "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. – Clément Jan 29 '19 at 03:44

3 Answers3

30

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

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

Bart Burg
  • 4,786
  • 7
  • 52
  • 87
  • `http://caniuse.com/#feat=mpeg4` Safari 9.5 DO support mp4 (and does not support ogv and webm) – Paolo Mar 09 '17 at 07:51
  • Did I say it wasn't? – Bart Burg Apr 07 '17 at 12:36
  • 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...?) – Paolo Apr 07 '17 at 13:32
  • 2
    Ah I get what you mean now. You should report it to caniuse :) – Bart Burg Apr 07 '17 at 14:25
  • 1
    That's not true when other formats render same video quality with around **70% less file size than MP4**, formats like **WEBM** and **HEVC**. – Christos Lytras Jul 22 '22 at 18:06
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.

Paul D. Waite
  • 96,640
  • 56
  • 199
  • 270
  • 2
    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. – nitech Jun 25 '12 at 11:11
  • @nitech: you‘re very welcome. Note that users of these browsers may have Flash installed too, and thus see the video. – Paul D. Waite Jun 25 '12 at 13:36
  • 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. – nitech Jun 26 '12 at 07:50
  • 1
    Here is a table for cross browser video/audio support: https://developer.mozilla.org/en-US/docs/Web/HTML/Supported_media_formats#Browser_compatibility – retrovertigo Jan 18 '15 at 10:35
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.

Developer
  • 231
  • 4
  • 19
longi
  • 11,104
  • 10
  • 55
  • 89
  • This seems logically. But why do you think sites like http://videojs.com/docs/setup/ tell you to use both ogv and webm? – nitech Jun 25 '12 at 10:58
  • @nitech: to support older versions of Firefox, Opera and Chrome. See [my answer](http://stackoverflow.com/a/11188058/20578). – Paul D. Waite Jun 25 '12 at 11:03