.mp4 file not playing in chrome

I want to show a video on my website. I have created a .mp4 file and using the HTML5 video tag to add it to the html.

The problem is that it is not being displayed in chrome. I would also like to know how I can replay it again and again.


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.

    Source: user: eithedog

    This also can help: chrome could play html5 mp4 video but html5test said chrome did not support mp4 video codec

    Also check your version of crome here: html5test


    This started out as an attempt to cast video from my pc to a tv (with subtitles) eventually using Chromecast. And I ended up in this "does not play mp4" situation. However I seemed to have proved that Chrome will play (exactly the same) mp4 as long as it isn't wrapped in html(5) So here is what I have constructed. I have made a webpage under localhost and in there is a default.htm which contains:-

    <!DOCTYPE html>
    <html>
    <head>
    </head>
    <body>
    <video  controls >
     <source src="sample.mp4" type="video/mp4">
     <track kind="subtitles" src="sample.vtt" label="gcsubs" srclang="eng">
    </video>
    </body>
    </html>
    

    the video and subtitle files are stored in the same folder as default.htm

    I have the very latest version of Chrome (just updated this morning)

    When I type the appropriate localhost... into my Chrome browser a black square appears with a "GO" arrow and an elapsed time bar, a mute button and an icon which says "CC". If I hit the go arrow, nothing happens (it doesn't change to "pause", the elapsed time doesn't move, and the timer sticks at 0:00. There are no error messages - nothing!

    (note that if I input localhost.. to IE11 the video plays!!!!

    In Chrome if I enter the disc address of sample.mp4 (ie C:webstoresample.mp4 then Chrome will play the video fine ?.

    This last bit is probably a working solution for Chromecast except that I cannot see any subtitles. I really want a solution with working subtitles. I just don't understand what is different in Chrome between the two methods of playing mp4


    遇到同样的问题,我通过在iMovie中使用默认mp4设置重新转换文件来解决此问题。

    链接地址: http://www.djcxy.com/p/80628.html

    上一篇: 红宝石2.1.2下的ide宝石

    下一篇: .mp4文件不能用chrome播放