HTML5视频格式最佳做法 [英] HTML5 Video Format Best Practices

查看:62
本文介绍了HTML5视频格式最佳做法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在努力添加将视频上传到正在开发的CMS的功能,并且对于上传视频的最佳做法"感到有些困惑.这些视频将使用Video.js库播放.

I am working on adding the ability to upload videos to a CMS that I am developing, and I am a little confused about the "best practices" for uploading videos. The videos will be played using the Video.js library.

我对HTML5视频的理解是,存在三种可能的格式:MP4,OGG和WEBM.看来所有浏览器都支持MP4,而其他两种浏览器均不支持MP4.

My understanding of HTML5 videos is that there are three possible formats: MP4, OGG and WEBM. It would appear that MP4 is supported by all browsers while the other two are less supported.

  • 如果我想允许用户上传任何类型的视频,那么我是否必须将他们上传的所有内容转换为适用于HTML5的格式?还是有其他方法可以解决这个问题?
  • 如果基本上所有地方都支持MP4,那么包括其他两种格式有什么意义?如果我在用户上传后转换了视频,是否应该将视频转换成所有三个版本?
  • 我认为,当您将视频上传到YouTube时,他们会将视频转换为正确的格式吗?还是他们还能播放任何视频格式?
  • 有没有可用的库或技术可以快速转换上传的视频?

推荐答案

MP4(详细来说是h.264压缩和MP4容器)具有由私人公司MPEG LA持有的许可/权利.这就是为什么某些浏览器希望避免依赖它的原因.尽管浏览器不太可能放弃其现有支持,但是许可证问题阻止开发人员认为浏览器对MP4/h.264的支持将永远持续下去.

MP4, (in detail h.264 compression and MP4 container) has a license / rights held by a private company, MPEG LA. That's why some of the browsers want to avoid depending on it. Although browsers are not likely to drop their existing support, license issues prevent developers to think browsers' support for MP4/h.264 will continue forever.

Google已宣布它将删除在2011年的Chromium项目中提供了.264支持,但Chrome仍然支持.

Google has announced that it would remove h.264 support from Chromium project in 2011 but Chrome still supports it.

Google的VP8和VP9(和WEBM容器)具有免费和开放的许可证.但是由于竞争,并非所有其他浏览器都愿意为VP8-9/WEBM提供支持.这可能会及时更改/改善.例如,尽管所有Internet Explorer版本都不支持WEBM,但

Google's VP8 and VP9 (and WEBM container) has a free and open license. But due to competition, not all of the other browsers are willing to give support for VP8-9/WEBM. This may changing / improving in time. For example while none of the Internet Explorer versions had WEBM support, Edge does. Apparently, only Apply Safari in major browsers, lacks WEBM support.

MPEG LA同时宣布它将不会对其在互联网上使用的格式收费,实际上这并不能使h.264/MP4格式完全免费.

MPEG LA in the meantime keep announcing that it will not charge for their formats use on the internet, this in reality does not make the h.264/MP4 format completely free.

因此,这些使得网站提供视频内容时有必要仔细考虑其浏览器/格式支持.我认为,即使MP4部分内容可能在几年内可以安全清除,也应该至少为每个视频创建一个MP4和WEBM副本.

So these make necessary for the sites provide video content to think carefully about their browser / format support. I believe at least an MP4 and a WEBM copy of every video should be created even if MP4 part of the content might be safe to be purged in a few years.

上传后几乎必须进行一次转换.视频编码器和包装器有大量不同的参数,如果您接受原样上传的视频,则可能会遇到丛林.

A conversion after upload is nearly a must. Video encoders and wrappers have tons of different parameters and if you accept the videos uploaded as they are, you may end up with a jungle.

Youtube确实对视频进行了重新编码,并且有一些证据他们至少使用 ffmpeg 来完成某些任务.

Youtube does re-encode the videos and there are some evidences that they are using ffmpeg at least to do some of their tasks.

这篇关于HTML5视频格式最佳做法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆