I have a couple of videos uploaded to Hostgator (my hosting service), and I'm displaying them on a page with the HTML5 video player. The video is there (I know because I can hear the audio,) but in Chrome all I see is a black screen, and in Firefox it won't play at all, just says "No video with supported format and MIME type found."
The video files are both ones I had to convert from a .mov to a .mp4. But they are all mp4 files.
When I download the videos again from Hostgator, they are normal, so I don't think anything is wrong strictly with the files themselves.
What could be going wrong here? Thank in advance.
I suppose the issue is in wrong codec. It should be h.264 for MP4 file.
Source with instruction http://www.freemake.com/how_to/how_to_create_and_embed_html5_video
Web video is complicated, most browsers support different video formats (codecs). To be compatible with all browsers you need every video in 3 different file formats: MP4, OGG, WEBM.
For maximum compatibility, here’s what your video workflow will look
like:
Make one version that uses WebM (VP8 + Vorbis).
Make another version that uses H.264 baseline video and AAC “low complexity” audio in an MP4 container.
Make another version that uses Theora video and Vorbis audio in an Ogg container.
Link to all three video files from a single element, and fall back to a Flash-based video player.
<video width="320" height="240" controls>
<source src="video.mp4" type="video/mp4">
<source src="video.webm" type="video/webm">
<source src="video.ogv" type="video/ogg">
</video>
Source: http://diveintohtml5.info/video.html#what-works
Related
I'm having issues with my .mp4 vidoes not playing on mobile on either Chrome or Safari (haven't tried Explorer or Mozilla). This is the code that I am using for the videos:
<video autoplay loop autobuffer muted playsinline style="width:100%; height:auto;">
<source src="/static_imgs/lo_macbook_mockup.mp4" type="video/mp4">
<img src="/static_imgs/lo_site_reskin_img.jpg" title="Legal Outreach site reskin." />
</video>
I've tried with and without playsinline and muted but still nothing. Works fine on desktop. The site with the videos listed is https://bigsheep.design/projects/legal-outreach-4
It's possible the H264 profile of High # Level 5 is not supported on your test mobile device.
Try to export (or re-encode) the video with a Profile settings of Baseline # Level 3. This basic profile can decoded by the video chips in most devices, after that you can try increasing up to Main and try different Levels for it.
In your video encoding tool, you want to find similar option to this (image from Handbrake tool):
I'm trying to serve some video content from a webserver, with the intention of supporting a reasonably wide set of browsers.
For iOS, as far as I can tell the way to go is to use HLS (HTTP Live Streaming) whereas on the desktop (and I guess Android?) MPEG-DASH is the state of the art. As a fallback I can provide a few static videos.
I've got this working on iOS with HLS and Chrome, Firefox, Opera, and Edge on desktop, but Safari on Mac just shows an activity spinner when I press play. As far as I can tell, this is because Safari tries and fails to use DASH as the playback method despite lack of Webm support and HLS being listed first.
For MPEG-DASH I have used Webm with VP9 and Opus, and my <video> tag looks something like this:
<video controls style="display:inline-block;max-width:174.22vh;max-height:98vh;width:98vw;height:55.125vw;background-color:#ccc;" preload="auto" poster="my-preview-image.jpg" data-dashjs-player>
<source src="myvideo/hls/playlist.m3u8" type="application/x-mpegURL">
<source src="myvideo/dash/manifest.mpd" type="application/dash+xml">
<source src="myvideo/myvideo-vp9.webm" type="video/webm; codecs=vp9,opus">
<source src="myvideo/myvideo-vp8.webm" type="video/webm; codecs=vp8,vorbis">
<source src="myvideo/myvideo-h264.m4v" type="video/mp4; codecs=h264,aac">
</video>
And I'm just importing the reference DASH implementation using
<script src="dash.all.min.js"></script>
I'm generating the HLS and DASH streams using ffmpeg from a high-quality master video exported from Final Cut Pro. The static Webm fallback files are also generated using ffmpeg while the H264 static fallback file is a lower-bitrate export from Final Cut Pro.
Is there a way I can either:
Tell DASH to respect the order of the sources and not jump ahead of the HLS stream
Or, not kick in if video/webm; codecs=vp9,opus is not supported by the browser.
Finally, if neither of those are possible, can I support multiple different codecs simultaneously with DASH? i.e. can I provide both VP9 and H264 DASH streams and have it pick VP9 over H264 where supported and otherwise fall back to H264 (higher bitrate or lower quality)? How would I go about producing that stream data?
From what you have shared, your browser will use the dashjs player when it encounters the video tag with the 'data-dashjs-player' attribute and the DASH player will focus on the formats it supports which do not include HLS.
As a crude solution you could check whether the browser can play HLS and use the native video tag if it can and your DASH player if it does not. Checking for HLS playback is a little undefined but the below approach appears to work at this time:
document.createElement('video').canPlayType('application/vnd.apple.mpegURL')
This should return 'maybe' on a browser which can play HLS (only Safari at this time AFAIK) and nothing if it can't - I just tested it on Safari and Chrome and it seems to behave like this.
Its worth noting that dash.js should be able to play MPEG DASH files on safari so it may be worth looking into the console or logs to try to find why it will not play your DASH video.
I have implemented a web application which uses html audio player. We will be having two type of audio files
mp3
m4a
both files are playing fine in windows chrome, edge and firefox.
Regarding m4a file in safari browser it was throwing Error instead of playing.We tried with below cases
Case 1: Added Mime extension and audio type to "audio/mp4".
Case 2: Added audio type to "audio/x-m4a".
Case 3: Does not provided audio type.
<audio controls><source src="Audio.m4a" type="audio/mp4"></audio>
This would vary depending on which OS version and browser versions you have, but the following works on MacOS Catalina in both Safari and Chrome.
<audio controls>
<source src="test.m4a" type="audio/x-m4a">
<source src="test.mp3" type="audio/mp3">
Your browser does not support the audio tag.
</audio>
Note the "audio/x-m4a" type for .m4a files.
You can check for audio player type compatibility by grabbing the HTMLAudioElement and calling:
console.log("Can play m4a:" + audioElement.canPlayType('audio/x-m4a'));
Am closing this task with answer as M4A cannot be played in MAC Safari browser in html audio player tag after trying out all possible solutions across different sites
I've been working on an HTML5 video implementation, but I'm having some issues. I've been following the guide at http://diveintohtml5.info/video.html. I have encoded .m4v, .ogv, and .webm versions of all of the video. Chrome and Firefox have no troubles playing the video. When I attempt to play it in Safari, it loads the video container, but not the video. You see a white space where the video should be, the controls, and the "loading" text. In Web Inspector's network tab, the video's status is "pending" and the mime-type is "undefined". Interestingly, I only experience this problem on the staging site, while it works fine on my local dev.
When I visit the video directly in the browser on local dev, I get the following output in the console:
Resource interpreted as Document but transferred with MIME type video/x-m4v.
GET http://site.dev/content/videos/movie.m4v Plug-in handled load
Note that GET has a little red x to the left of it in the inspector.
My html code looks like:
<video class="html5-video" width="700" controls>
<source src="content/videos/movie.m4v" type='video/mp4; codecs="avc1.42E01E, mp4a.40.2"' />
<source src="content/videos/movie.webm" type='video/webm; codecs="vp8, vorbis"' />
<source src="content/videos/movie.ogv" type='video/ogg; codecs="theora, vorbis"' />
Your browser does not support this video.
</video>
Additionally, the video is ~20mb.
Any thoughts? Thanks!
Well...it turns out that the issue occurred because I was using .htaccess to password protect the directory. Interestingly, all browsers except for Safari would allow access to the video files. Thanks to those who helped!
Try encoding to mp4 and replace this file instead m4v format, update your code and run.
Work's fine.
I am trying to play mp4 video using html5 video tag. But in FF 3.6 its just showing a black window with cross sign. Its playing in Chrome.
I can play that video in windows media player (i.e. the required codec are installed)
How can i play that video in FF too?
<video id="video1" width="200" height="200" controls="true">
<source src="video1.mp4" type='video/mp4; codecs="avc1.64001E, mp4a.40.2"' />
Your browser does not support mp4 videos
</video>
firefox does not support most MPEG4 natively due to licencing. you can save your video in a few different types and use canPlayType(type) method.
more here:
http://wiki.whatwg.org/wiki/Video_type_parameters
http://www.whatwg.org/specs/web-apps/current-work/multipage/video.html#dom-navigator-canplaytype
For Firefox, you'll have to encode the video as Theora and save as an .ogv file.
http://diveintohtml5.info/video.html#what-works