12

The latest version of Chrome (Version 27.0.1453.110 m) as of 5 June 2013 does not play mp4 videos. For an example W3Schools Video Sandbox gives me video controls and nothing else. (Sorry can't post a screen shot, just signed up to StackO.)

Anyone know why?? and a fix?

Yes:

There is an answered question like this

chrome could play html5 mp4 video but html5test said chrome did not support mp4 video codec

and

There is an unanswered question like this:

html5 video issue with chrome

Community
  • 1
  • 1
Stephan Luis
  • 911
  • 1
  • 9
  • 24
  • im using the same version of chrome and everything is working just fine? try it with an tag (so without the – Marco Geertsma Jun 05 '13 at 10:41
  • 1
    Your browser does not support the video tag. Gives 'Your browser does not support the video tag'. Also .mp4 files do not play if opened from local source . – Stephan Luis Jun 05 '13 at 11:04
  • also using the url http://www.w3schools.com/html/movie.mp4 gives a black screen with controls – Stephan Luis Jun 05 '13 at 11:09
  • once again the video plays perfectly, if your linking a mp4 file locally you need to describe the path from the site's root. So for example assets/video/lorem.mp4. – Marco Geertsma Jun 05 '13 at 11:21
  • If the screen remains black simply try adding a random video from the internet in there, that should work the same and thus have the same results. A quick video : http://www.youtube.com/watch?v=AvT9VhgROe0 – Marco Geertsma Jun 05 '13 at 11:22
  • Youtube videos play, they are embedded flash, also .webm play but not .mp4 local or internet urls. – Stephan Luis Jun 05 '13 at 11:36
  • It's a codecs issue, as such the behavior will be different between the computers, depending upon what codecs are installed on your machine (Quicktime / DivX / ???). Currently tackling this issue as well. – eithed Jun 10 '13 at 11:49
  • I'm getting highly pixelated video when I play the W3Schools video. But if I replay it, it plays fine. Sounds like a Chrome bug more than a codec issue. BTW, I've had the same problem with playing my own mp4 files in Chrome via the web. WebM files play beautifully. – Clay Nichols Oct 22 '13 at 00:05
  • Had the same problem. MP4 video plays in Firefox, but not in Chrome and IE. Solution: provided both MP4 and WEBM formats and now it works in all 3. This format "war" is so stupid and annoying !! – Radu Murzea May 23 '14 at 19:30

6 Answers6

8

After running into the same issue - here're some of my thoughts:

  • due to Chrome removing support for h264, on some machines, mp4 videos encoded with it will either not work (throwing an Parser error when viewing under Firebug/Network tab - consistent with issue submitted here), or crash the browser, depending upon the encoding settings
  • it isn't consistent - it entirely depends upon the codecs installed on the computer - while I didn't encounter this issue on my machine, we did have one in the office where the issue occurred (and thus we used this one for testing)
  • it might to do with Quicktime / divX settings (the machine in question had an older version of Quicktime than my native one - we didn't want to loose our testing pc though, so we didn't update it).

As it affects only Chrome (other browsers work fine with VideoForEverybody solution) the solution I've used is:

  • for every mp4 file, create a Theora encoded mp4 file (example.mp4 -> example_c.mp4)
  • apply following js:

    if (window.chrome)
        $("[type=video\\\/mp4]").each(function()
        {
            $(this).attr('src', $(this).attr('src').replace(".mp4", "_c.mp4"));
        });
    

Unfortunately it's a bad Chrome hack, but hey, at least it works.

eithed
  • 3,933
  • 6
  • 40
  • 60
  • What machines was Chrome support for h.264 removed on? CanIUse.com reports that chrome supports h.264: http://caniuse.com/#search=mp4 – Clay Nichols Oct 19 '13 at 15:36
  • There's a coma there for a reason ;) Yes - CanIUse reports ongoing support, though that doesn't mean that the issue isn't there. I thought it could be due to Chrome removing the support, going for the webm, but it might as well be a bug. Take a look at the bug report I've linked to. – eithed Oct 21 '13 at 08:53
3

I have had the same problem, Even though I didn't get any answer, I tried to solve it in another way, here is what I did:

First, embed the video in your html:

<video id="videoId" width="100%" autoplay loop>
  <source src="main.webm" type="video/webm">
  <source src="main.mp4" type="video/mp4">

Your browser does not support the video tag.
</video>

Then detect if the Browser is chrome:

var isChrome = !!window.chrome; 
var isIE = /*@cc_on!@*/false;

If its chrome, replace the video with webm version. (For those who haven't faced the problem themselves: if you embed both mp4 and webm , chrome will not play any of them, so you have to embed "webm" only)

if( isChrome ) {
$("#videoId").replaceWith($('<video id="videoId" width="100%" autoplay loop><source src="video.webm" type="video/webm"></video>'));
}

And as for IE: In my case I replaced the html5 video with an image:

if( isIE ) {
$("#videoId").replaceWith($('<img id="videoId" src="img/video.jpg" />'));
} 
Ramtin Gh
  • 1,035
  • 2
  • 11
  • 31
  • I also have a script to detect firefox and update the video source to an ogg format. Thought of updating script so that Chrome plays webm, but it's not so important that I can't play the video on this one machine. **How many of my users have the same problem??** – Stephan Luis Jun 05 '13 at 20:56
3

It seems that Chrome loads the first video declared. So for Chrome playing webMV, first declare the webMV video, then the mp4 one, and so on.

Michael Petrotta
  • 59,888
  • 27
  • 145
  • 179
artpixel
  • 31
  • 1
0

The answer is in a previous post although difficult to find:

chrome could play html5 mp4 video but html5test said chrome did not support mp4 video codec

It has to do with the phasing out of mp4 support in Chrome in favor of webm open format. Currently browser support seems spurious. See the post for informative details.

The Cromium forum provides further information about the codec support.

Hope this helps.

Community
  • 1
  • 1
Stephan Luis
  • 911
  • 1
  • 9
  • 24
0

I have this problem also on Chrome version:28.0.1500.72 on Windows7 64bit. Although it does not affect the same version of Chrome on WinXP. From what I have read this problem is very sporadic on different hosts depending on a number of variables. However, thanks to some quick jquery I was able to resolve this issue for my potential Chrome users.

Thanks Sony Flat for pointing me in this direction

var isChrome = !!window.chrome; 
var isIE = /*@cc_on!@*/false;

if( isChrome ) {
$("#videoId").replaceWith($('<video id="videoId" width="100%" autoplay loop><source src="video.webm" type="video/webm"></video>'));
}
jh314
  • 27,144
  • 16
  • 62
  • 82
TMNetworks
  • 69
  • 1
  • 3
0

Thanks eithedog. This code is working for me to play video on Chrome using "Video" tag

if (window.chrome) {
                $("[type=video\\\/mp4]").each(function () {
                    $(this).attr('src', $(this).attr('src').replace(".mp4", "_c.mp4"));
                });
            }
Nitesh
  • 1