Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

html5 video is not playing mp4 error "Invalid Source"?

Tags:

html

I am trying HTML5 video tag and I have downloaded a Microsoft sample and trying to run it but a strange thing is happening, and it is that it plays video coming from a URL (commented tag) but for local mp4 file it do not shows error and shows message "Invalid Source"

Here is my code please guide me what I should do to make it run local file correctly ?

Thanks

    <!DOCTYPE html>
<html>
<head>
</head>
<body>
    <!--<video src="http://www.bing.com/az/hprichv/?p=Butterfly_Clipcanvas_223479_EN-US.mp4"
        autoplay loop>
    </video>-->
    <video controls src="hprichv.mp4" width="300" height="200" autoplay loop>
    </video>
</body>
</html>

EDIT

Web page and video files both reside in the same folder.

like image 707
user576510 Avatar asked Dec 29 '12 07:12

user576510


People also ask

Why is my video not working in HTML5?

If your browser error "HTML5 video file not found", it means that your browser is not up to date or website pages does not have a suitable video codec. It would help if you communicated with the developer to solve the issue and install all the required codecs.

Is MP4 compatible with HTML5?

The minimum for HTML5 video is MP4 + WebM or Ogg (or both), using the MP4 version for Flash fallback.

Why is my video not loading in HTML?

If you encountered “HTML5 video not found” error while playing a video on any website then it implies your browser doesn't support the HTML5 format codecs or your browser doesn't have the proper video codec installed.

Which video formats is not allowed by HTML?

A video exists in different formats such as MP4, MPEG, WebM, Ogg, AVI, QuickTime, etc. But HTML supports only 3 types of video formats, which include MP4, Ogg, and WebM.


3 Answers

I got this problem and found that the video codec was not supported.

Get a video converter software (like Oxelon - it is free) and choose the output to be .mp4 (even is the source is .mp4). Choose the video codec to be "H264" and the audio codec to be "AAC". This will solve your problem.

like image 189
Omar Avatar answered Oct 25 '22 00:10

Omar


Im on Windows 7 Pro. I develop locally and then host/serve remotely. Trying to load a local mp4 file while developing locally ran into this identical situation. No combination of using localhost/myvideo.mp4 or 127.0.0.1/myvideo.mp4 or /aaa/myvideo.mp4 or myvideo.mp4 in same directory as file got things to work...but referencing a full URL like http://www.mywebsite.com/myvideo.mp4 did, as above.

On local machine, Chrome shows no error messages...just shows black box with controls. No clues as to whats up. Switched to IE and it showed the black box and controls and the error message. 'Invalid source'

I focused on @steveax question and Mime types.

Turns out IIS in this version of windows/IIS does not have a MIME type setup for .mp4. No clue why not...but not.

To add the MP4 MIME type, open Internet Information Services (IIS) Manager and follow these steps:

  • Highlight Default Web Site on the left panel;
  • Double-click MIME Types on the right panel;
  • Scroll down the list and notice that there is no .mp4;
  • On the right panel again, click Add: at the first field, write .mp4 and on the field below write video/mp4
  • Click OK and you are done.

Restart IIS!

like image 30
bryanp Avatar answered Oct 25 '22 01:10

bryanp


I had the same problem

For Internet Explorer

I used FormatFactory, setting up AAC encoding for audio and H264 for output for the mp4 format, in "High Quality and big size"

For Google Chrome

I converted my original video to the webm format thanks to Free WebM Video Converter (make sure you uncheck everything that would like to install ads).

It took a long time but then it worked in Chrome.

<video controls>
  <source src="thevideo.mp4" type="video/mp4">
  <source src="thevideo.webm" type="video/webm">
</video>
like image 22
Mikaël Mayer Avatar answered Oct 24 '22 23:10

Mikaël Mayer