问题
I'm trying to set up my site to use HTML 5 videos. The mp4 files are served from S3. I've got the MIME type right, and the URL is right. It's not working though. The only thing I can think of is the codec being wrong.
Here is my code:
<video width="320" height="240" controls>
<source src="{url}" type='video/mp4; codecs="avc1.42E01E, mp4a.40.2"'>
</video>
Now as I understand it, the audio codec is always the same. mp4a.40.2. The video is encoded as baseline, but according to http://wiki.whatwg.org/wiki/Video_type_parameters#MPEG-4, the last two characters of the video codec, in my code 1E
are variable.
Is having the wrong characters enough to cause the video to not work? If so, how do I find the right settings?
I'm having a hard time wrapping my head around this stuff. Thanks for any help you can provide.
回答1:
The idea of the video codecs information is that your browser won't download the video if it can't play it. (found that here) So I think even with a wrong, but common, avc level (last 2 chars) it should download and play. I found this guide how to determine and change your avc level using a hex editor. Megui apparently also works for that.
回答2:
Try removing the type
attribute. If that makes it work, you've found the problem. Also, check the actual Content-Type
HTTP header.
来源:https://stackoverflow.com/questions/3283041/html-5-video-problem