Streaming media from Amazon S3

Thanks John for the reminder to investigate S3 as a business media hosting service, it works like a charm!

Now that I have far fewer bandwidth worries (max $0.17 per GB), the Torus Knot site includes a nifty dynamic selector so you can pick low, medium or high quality – the latter is at a higher resolution too, clocking in at about 100Mb. I may well use S3 for future public commercial downloads in the future too. It’s altogether more convenient than the block bandwidth allocations you get with regular hosting packages, since it scales dynamically at a very fine level of detail depending on demand. And don’t be fooled by ‘unlimited’ bandwidth offers, all hosting companies have to pay for bandwidth and there’s no such thing as ‘unlimited’ resources; you’ll actually find your bandwidth being throttled or cut off via a ‘reasonable use’ clause in the small-print; ‘unlimited’ is simply a marketing lure. If you want truly scalable guaranteed bandwidth, you have to pay for it.

Getting S3 media hosting working wasn’t that hard, but did require a few discrete steps. Firstly, you need to create a bucket in your S3 account which is all in lower case, is globally unique and is DNS-compatible; so for example I created a bucket called ‘media.torusknot.com’.

Then to make it all look nice you need to create a DNS CNAME entry to map a sub-domain of your site to that S3 bucket; in my case I mapped ‘media.torusknot.com’ to ‘media.torusknot.com.s3.amazonaws.com’. That allows me to access any files I upload to that S3 bucket via ‘http://media.torusknot.com/somefile.jpg’. You do just need to set the ACLs on the files & the bucket to make sure public access is allowed.

Finally, if you want to stream video files via a Flash player from S3 to another domain, you also have to tell Flash that it’s ok for the content to be pulled in from a different domain. Create a file called ‘crossdomain.xml’ in the bucket, with these contents:

<cross-domain-policy>
<site-control permitted-cross-domain-policies="all"/>
</cross>

That allows the media to be accessed from anywhere – you can be more specific if you want but this is the simplest approach.

Once again I’m using the excellent FlowPlayer; my only issue with it is that the ‘buffering’ animation seems to not work all the time (so be patient if you’re viewing the high quality version).

Gotta love this cloud computing business :)

  • Falagard

    So…when do we get to download a demo? :-D

  • http://www.stevestreeting.com Steve

    I’d really like to come up with a more interesting scene for a downloadable demo, something including some terrain, some water, HDR lighting, maybe a building or two, that sort of thing. I can make the tech demo here interesting by picking my camera angles but really it’s just a plane with random trees & grass on it ;) I need to do more…

  • http://www.spannerworx.com Paul Downey

    Aah, very interesting! Both the S3 service and this FlowPlayer are things I may actually be needing at some point in the future, cheers for the heads up.

    About FlowPlayer, are you currently running the GPL License/free version? If not, do you know limitations you get without paying for a commercial license? E.g. it mentions a FlowPlayer logo, but I cant see one on yours anywhere.

  • James

    ohh than I was wrong, but good to know that is possible.

  • http://www.stevestreeting.com Steve

    @Paul: yes, I’m using the GPL version, it means that all my Javascript that references the player is GPL (check view source – it means you can use my quality switcher under the GPL if you want :)). The logo is shown in fullscreen mode (which I happened to disable because I think it’s too blocky), but that’s actually not a condition of the GPL anyway, they just say on the site that the GPL version contains the logo in fullscreen mode, not that you have to have one.

    I might make the link to FlowPlayer.org (for the source) more obvious though – you get it as standard by right-clicking on the video but I think I will create a separate dedicated HTML link for it somewhere too just to make sure.

  • http://www.spannerworx.com Paul

    Ah right, cool, ta.

    Hmm its a shame that by disabling a function like the Fullscreen doesnt actually remove/grey it out from the menu.

    Still on the web theme, how are you finding google analytics?

  • http://www.kieransenior.co.uk Kezzer

    I had been considering going with S3 but I couldn’t justify it completely as I don’t use that much storage anyway. OgreSpeedTree looks sweet, and the TKS revamp looks sweet.

  • http://www.stevestreeting.com Steve

    @Paul: Analytics is pretty cool, very easy to use and although in many ways I prefer raw log analysers, there’s no doubt that analytics is going to be better for tracking marketing results, which I’m going to have to learn about.

  • Dark Sylinc

    Cool video. Cool software
    But I warn you: The video starts downloading each time I visit the blog. Regular video players start downloading when I click on them. This one starts as soon as I entered the webpage.
    If you’re worried about $$/bandwidth, you may want to fix that. People who aren’t interested in the video or already saw it are still consuming your bandwidth.

    Congratulations for hitting the milestone

    Cheers

  • http://www.streamincloud.com Daniel

    Nice video! Very high quality. Have you seen http://www.streamincloud.com? They will convert all your videos in a bucket to FLV. Easy and free, can’t beat that.

    I agree with Dark Sylinc – set autoBuffer to false so your flowplayer doesn’t start downloading the video every time the page loads. That should help out your bandwidth costs.

  • Pingback: | panoskolivanis.com

  • http://dreamlifeplaybook.com ken

    Hello, seems not yet clear to me how to stream video from my Amazon s3 using Flowplayer. Any tutorials online that you may know please.

  • http://www.stevestreeting.com Steve

    http://flowplayer.org/demos/installation/index.html

    And just use an S3 URL as the source for the video – it’s no more complicated than that.

  • http://businessheretics.com spinhead

    It’s only that simple if you set the permissions to ‘everyone in the world’

    If you use S3’s querystring auth to protect your bandwidth, it’s much more complex.

    Much.

  • http://www.miracletutorials.com JohnR

    Ever heard of S3Media Stream? Its a plugin for WordPress, although there is also a Joomla version. It basically automates the display of private RTMP streaming videos (via S3 Amazon) and audios on your site. Just Google it and you will find it easily.sets haveye