I am serving a video via the HTML5 video
element. I'm finding conflicting information about the appropriate MIME type for m4v
video. Most demos set the type
attribute to video/mp4
in the source
tag in the markup. Some articles I've read indicate video/m4v
for the web server Mimetype, while others indicate video/mp4
. Which is correct?
See for example, this article indicating video/m4v
mimetype: http://html5center.sourceforge.net/make-your-html5-video-play-on-mobile-devices
And this article indicating video/mp4
: http://www.coolestguyplanettech.com/use-html-5-video-on-all-browsers/
Strictly talking about file quality, there is very little difference between MP4 and M4V. When you compare M4V vs. MP4 in detail, you'll find that the M4V format often has more data stored for subtitles, and features DRM protection to prevent privacy. MP4 is more widely accessible for all devices including Android.
What is a M4V file? M4V essentially stores videos that have been downloaded from the Apple iTunes store. While this file format has some similarities to MP4, it is subject to Apple's FairPlay DRM copyright protection—users can't play M4V files that are copy-protected without authorization.
m4v files may be protected by Apple's DRM. In this case, renaming to . mp4 is not possible, and you cannot convert the file itself either, as it is copyright-protected and can only be played with iTunes on the machine it was bought on.
M4V is a container video format developed by Apple, closely resembling the MP4 format. The main difference between M4V and MP4 is that an M4V file can enjoy DRM copy protection. Apple encodes video files in the iTunes Store using M4V.
The standard media type is video/mp4
.
The standard mp4 container format is commonly used for both AAC audio, and H.264 video + AAC audio. These have different media types, audio/mp4
and video/mp4
, however often you want different applications for audio and video and on some systems it is only possible to associate a default application with a file extension. Therefore it has become popular in some circles to use the extensions .m4a
and .m4v
for audio and video(+audio), respectively, in an mp4 container. However this does not affect the media type, which already distinguishes these using the audio or video prefix.
A twist, however, is that Apple started using their own media type, video/x-m4v
, for videos from their store, which are in an mp4 container and use a .m4v
extension. This is set to open the video in iTunes by default. Sometimes that is necessary because the video uses DRM, AC-3 Dolby Digital audio, or other capabilities that are not commonly supported in an mp4 container, but which are supported by iTunes for files with a .m4v
extension. If you rely on such capabilities then you may want to use this media type instead of the standard one.
Media types with no x-
are standardized in an RFC and tracked by IANA. No media type with the name video/m4v
has been standardized. Non-standard media types have a x-
prefix.
I only write HTML5 for special projects, but I've had a problem which I was able to solve quite by accident. In my blocks, I was writing the video code like this:
<source src="Videos/myvideo.mp4" type="video/mp4"> <source src="Videos/myvideo.webm" type="video/webm">
Here was my problem: If I put the mp4 line first, Google Chrome would play the video part, but there would be no sound. If I put the webm line first, Google Chrome would play the video and sound correctly, but Apple Safari would not detect the video at all. Even if I added the codec information in the type= statement, it had no effect.
I was about to cave in and try to use Flash, but I happened on the solution, mostly by accident. In the line for mp4, I replaced the type="video/mp4" with type="video/m4v". It cured the problem completely! Note: I did not change the video file extentions from mp4 to m4v -- I only used m4v in the type= statement.
I couldn't find any documentation to tell me to do this, I just got interested in the difference between .mp4 and .m4v file extentions, and started playing around. I use Linux (Xubuntu) and I had created my videos as both webm and H.264 mp4 files, using Openshot Video Editor. Maybe the inner workings of Openshot caused this to be an issue, but anyway -- that's how I solved this problem. My mp4 videos play perfectly. I hope this helps somebody else -- MinnesotaJon
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With