Html Amazon S3 托管流视频

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/3505612/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-29 04:10:41  来源:igfitidea点击:

Amazon S3 Hosting Streaming Video

htmlamazon-s3video-streaming

提问by user398371

If I make an Amazon s3 MP4 resource publically availible and then throw the Html5 Video tag around the resource's URL will it stream? Is it really that simple. There are a lot of "encoding" api's out there such as pandastream and zencoder and I'm not sure exactly what these companies do. Do they just manage bandwidth allocation(upgrading/downgrading stream quality and delivery rate/cross-platform optimization?) Or do encoding services do more then that.

如果我让 Amazon s3 MP4 资源公开可用,然后在资源的 URL 周围抛出 Html5 Video 标签,它会流式传输吗?真的有那么简单吗。有很多“编码”api,例如 pandastream 和 zencoder,我不确定这些公司到底是做什么的。他们只是管理带宽分配(升级/降级流质量和传输率/跨平台优化?)还是编码服务做的更多。

回答by Brandon Arbini

This is Brandon from Zencoder. What you're looking for is probably something like Video JS (videojs.com) for video playback. You can just upload an MP4 to S3 and reference it in a player (or the video tag directly, but that has additional issues). Our service is actually used for transcoding the video itself, not delivery. We actually created Video JS to help our customers (and the web at large) with easy, compatible HTML5 playback. If you have any other questions just ask. Thanks.

我是 Zencoder 的 Brandon。您正在寻找的可能类似于用于视频播放的 Video JS (videojs.com)。您可以将 MP4 上传到 S3 并在播放器中引用它(或直接使用视频标签,但这有其他问题)。我们的服务实际上用于对视频本身进行转码,而不是交付。我们实际上创建了 Video JS 来帮助我们的客户(以及整个网络)进行简单、兼容的 HTML5 播放。如果您有任何其他问题,请提问。谢谢。

回答by Aleksandr

The answer to the first part of your question is, yes, it is really that simple. There is a how-toabout it and a working demo at the end of the article that you can see as a proof of concept.

您问题第一部分的答案是,是的,就这么简单。有一个如何做这件事,并在文章,你可以作为一个概念证明看到的结尾工作演示。

回答by Malevolence

Amazon S3 is a really good choice for serving up video content. We've been using it for a couple of years with no issues and the cost has been unbeatable. You should also look at using Amazon CloudFront and configuring your media to use their "streaming distributions". It basically uses your S3 files but copies them to edge locations around the internet and uses RTMP to provide a better playback experience for users and to save you money on bandwidth.

Amazon S3 是提供视频内容的绝佳选择。我们已经使用它几年了,没有任何问题,而且成本是无与伦比的。您还应该考虑使用 Amazon CloudFront 并配置您的媒体以使用它们的“流分配”。它基本上使用您的 S3 文件,但将它们复制到 Internet 的边缘位置,并使用 RTMP 为用户提供更好的播放体验并为您节省带宽费用。

http://aws.amazon.com/cloudfront/

http://aws.amazon.com/cloudfront/

回答by Ryan

I just had the same question as you and was happy to see that uploading an mp4 file to S3, setting "public" permissions on it, and then using this simple HTML worked great without any additional tools. And CloudFront wasn't even necessary.

我只是和你有同样的问题,很高兴看到将 mp4 文件上传到 S3,为其设置“公共”权限,然后使用这个简单的 HTML 效果很好,无需任何其他工具。甚至不需要 CloudFront。

<video id="clip" controls preload=auto width=640 height=264 data-setup="{}">
    <source src="https://s3.amazonaws.com/xxxxbucketnamexxxxx/xxxxfilenamexxxx.mp4" type='video/mp4'/>        
</video>

回答by Stefan Lederer

Amazon S3 in combination with Amazon CloudFront as scalable CDN is pretty streight forward and good to build great video solutions, even Netflix-like systems using adaptive bitrate (ABR) video in HTML5 using the Media Source Extentions with MPEG-DASH or HLS, like done by Netflix or Youtube.

Amazon S3 与 Amazon CloudFront 结合作为可扩展的 CDN 非常直接,非常适合构建出色的视频解决方案,甚至是类似 Netflix 的系统,使用 HTML5 中的自适应比特率 (ABR) 视频,使用带有 MPEG-DASH 或 HLS 的媒体源扩展,就像完成的一样通过 Netflix 或 Youtube。

Here you can find a pretty good tutorial on that: http://www.bitcodin.com/blog/2015/02/create-mpeg-dash-hls-content-for-amazon-s3-and-cloudfront/

在这里你可以找到一个很好的教程:http: //www.bitcodin.com/blog/2015/02/create-mpeg-dash-hls-content-for-amazon-s3-and-cloudfront/

回答by Ravi Jayagopal

You can encode the video yourself using a free encoder like https://HandBrake.fr. Or your video editor (I use Camtasia) should have standard encoding options.

您可以使用免费的编码器(如https://HandBrake.fr )自己对视频进行编码。或者你的视频编辑器(我使用 Camtasia)应该有标准的编码选项。

Regarding the video player, you have a few options...

关于视频播放器,您有几个选择...

1) Simplest option: Upload to S3, make the file public, insert entire URL into WordPress, and it will automatically become a video player. But the player will have very basic options (no speed controls, ability to customize player controls, etc), and the URL is public, which means it's open to leeching and hotlinking and piracy.

1)最简单的选择:上传到S3,将文件公开,将整个URL插入WordPress,它会自动成为视频播放器。但是玩家将拥有非常基本的选项(没有速度控制、自定义玩家控制的能力等),并且 URL 是公开的,这意味着它对窃取、盗链和盗版持开放态度。

2) If you wish to secure the file itself, then upload to S3, make it private, make it accessible only to the root account, and then use a plugin like https://S3MediaVault.comwhich will create signed URL's in real-time when the page loads, and the link will expire shortly thereafter, based on how many seconds you want it to be active.

2)如果您希望保护文件本身,然后上传到 S3,将其设为私有,使其只能由 root 帐户访问,然后使用像https://S3MediaVault.com这样的插件,它会真实地创建签名 URL-页面加载的时间,链接将在此后不久过期,具体取决于您希望它处于活动状态的秒数。

3) And then if you want to protect the page itself, you'll have to use some kind of paywall software. So if you're using WordPress, this would be a WordPress membership plugin, which will protect the page and make one log in first using a username/password before they can access the page. And then the page will load, and signed URL's will be generated for your Video, and they can watch it from that page, or download it (if you let them).

3) 然后,如果您想保护页面本身,则必须使用某种付费墙软件。因此,如果您使用 WordPress,这将是一个 WordPress 会员插件,它将保护页面并在访问页面之前先使用用户名/密码进行登录。然后页面将加载,并为您的视频生成签名 URL,他们可以从该页面观看或下载它(如果您允许的话)。

4) You can also create streaming videos which are a lot harder to download for most regular people, because it is no longer just a .mp4 file - it is a .m3u8 and a bunch of .ts files, which are hard for most people to figure out. And then make those too signed URL's, and the video becomes even more harder to download.

4) 您还可以创建对于大多数普通人来说更难下载的流媒体视频,因为它不再只是一个 .mp4 文件 - 它是一个 .m3u8 和一堆 .ts 文件,这对大多数人来说很难弄清楚。然后制作那些太签名的 URL,视频变得更加难以下载。

And if you encode your streaming video using Apple's HLS technology, and set it to adaptive bit rate, then the stream will download as fast as, or as slow as, the viewer's internet connection. This can be good and bad depending on the situation, but that's an option.

如果您使用 Apple 的 HLS 技术对流视频进行编码,并将其设置为自适应比特率,那么流的下载速度将与观看者的互联网连接速度一样快或一样慢。根据情况,这可能是好是坏,但这是一种选择。