Order Now AdSolution Sign Up | Login » Bits on the Run Sign Up | Login »

Cloudfront RTMP Streaming?

24 replies [Last post]

Has anyone figured out how to take advantage of the new Amazon Cloudfront Streaming option announced today? I took a quick look at the RTMP tutorial, but I'm not 100% sure how that translates to use with Cloudfront. I'm assuming the player has to go in a traditional Cloudfront distribution, and the video goes in the streaming one. Anyone have this working yet and care to share?

Making progress: found this: http://docs.amazonwebservices.com/AmazonCloudFront/2009-12-01/DeveloperGuide/index.html?RTMPStreaming.html

Thats very interesting could you possibly post your code when you get it working?

still working on the code here too - will post if I figure out anything. Here's to hoping for a game-changing CDN!

I'm signed up and working on it too...

Here is a working example...

http://planet.casadehood.com/rtmp/cloudfront/bitswitch.html

The trick will be finding a way to secure it... I would appreciate any ideas in this area.

To secure it, just use the RTMPE protocol instead of the regular RTMP.

CloudFront uses Adobe Flash Media Server 3.5 to stream on-demand content with Adobe's Real-Time Messaging Protocol (RTMP). CloudFront accepts RTMP requests over port 1935 and port 80.

CloudFront supports the following variants of the RTMP protocol:

RTMP—Adobe's Real-Time Message Protocol

RTMPT—Adobe streaming tunneled over HTTP

RTMPE—Adobe encrypted

RTMPTE—Adobe encrypted tunneled over HTTP

Thanks Dustin... for those that don't want to use bitrate streaming and just want to serve a single file, you can use the following -- just replace the filename and cloudfront name with your own.

<script type='text/javascript' src='/flv/swfobject.js'></script>

<div id='mediaspace'>This text will be replaced</div>

<script type='text/javascript'>
  var so = new SWFObject('/flv/player.swf','ply','640','480','9','#ffffff');
  so.addParam('allowfullscreen','true');
  so.addParam('allowscriptaccess','always');
  so.addParam('wmode','opaque');
  so.addVariable('file','FILENAME.flv');
  so.addVariable('streamer','rtmp://CLOUDFRONTNAME.cloudfront.net/cfx/st');
  so.write('mediaspace');
</script>

Yep, got it working too. Hurrah!

Right - how does this do live streaming?

thanks dustin & brad!

To secure it, just use the RTMPE protocol instead of the regular RTMP.

Absolutely you'd have to use RTMPE... When I said secure, I was also referring to more than just encrypting the stream, some sort of token auth or url signing...

Anyone was able to stream a mp3 with this? With jw player I only here some noise, then it keeps buffering...

do we need to encode the .flv file differently for RTMP?

How are you deploying playlists using this method?

On the JW article for Streaming it says:

streamer=rtmp://www.mysite.com/application&file=http://www.mysite.com/path/to/playlist.xml

What would the 'application' element be for this when using amazon cludfront? Any examples?

Check out my very own tool CloudBerry Explorer that helps to manage S3 and CloudFront. The latest version supports CloudFront Streaming and you can also generate an HTML code snippets for JW Player. It is a freeware. http://s3.cloudberrylab.com/

With Amazon stating that "streaming private media files with a signed URL is not supported", does that mean that anyone who knows the URL of my CloudFront RTMP stream will be able to play it back via a player on their website? Or even a desktop application like VLC?

Should I go for a solution like Influxis if I need more control over who can have access to my paid video content?

Hello everyone. I'm trying to stream from Cloudfront and I can't tell if it is just slow or is waiting for the entire mp4 file to load before streaming. I've ran the Adobe Air app that is linked from this site to fix the "moov atom" - but from the response I don't know if 1. it is OK and should work or 2. does not have the moov atom. I created the file in Handbrake and selected the "web streaming" option, fwiw.

I'll include all that I can below, and any help would be greatly appreciated. Thanks, Dale

Link to video:
http://www.overshield.com/videos/teststream.htm

contents of that htm file:

<script type='text/javascript' src='swfobject.js'></script>
<div id='mediaspace'>This text will be replaced</div>
<script type='text/javascript'>
  var so = new SWFObject('player-viral.swf','mpl','640','380','9');
  so.addParam('allowfullscreen','true');
  so.addParam('allowscriptaccess','always');
  so.addParam('wmode','opaque');
  so.addVariable('duration','22');
  so.addVariable('file','stream/stream.mp4');
  so.addVariable('provider','rtmp');
  so.addVariable('bufferlength','5');
  so.addVariable('streamer','rtmp://s1kggw42et3qmb.cloudfront.net/cfx/st');
  so.write('mediaspace');
</script>

And here is a copy of the mp4 file (about 5.5 MB) that I'm trying to stream:
http://www.overshield.com/download/index.php?path=&download=stream.mp4

And the response from the Adobe Air app that fixes the moov atom when I process that mp4:

File.size: 5675044
Reading Atom Metadata: [code: ftyp,size: 28,offset: 0]
Reading Atom Metadata: [code: moov,size: 31402,offset: 28]
Reading Atom Metadata: [code: mdat,size: 5643614,offset: 31430]
ACTION: Parsing Bytes for Information 5675044
ERROR: The MOOV atom is not located at the end of the file, the file is ready for progressive download or it is a invalid file
Completed Time: 0.149s

You don't need to post process MP4 files with MP4Box for RTMP streaming.

Use a version 4.7 player until Longtail gets RTMP streaming working correctly in Player 5.

http://developer.longtailvideo.com/trac/log/trunk/as3/player.swf

jamix, I think I have read that amazon supports securing the stream with a crossdomain.xml file that limits access to the stream from your url. So People should not be able to play your stream from a stand alone player like vlc or from a web-player on another domain.

@all:
Any opinions on how secure this would be?

This is quoted from the Developer Guide for cloudfront

Crossdomain.xml

Adobe Flash Media Server allows the use of a crossdomain.xml file that specifies which domains can access media files in a particular domain. CloudFront supplies a default file that allows all domains to access the media files in your streaming distribution. If you implement a more restrictive crossdomain.xml file, CloudFront ignores it.

http://docs.amazonwebservices.com/AmazonCloudFront/latest/DeveloperGuide/index.html?RTMPStreaming.html

I'm using the CloudFront too, but when I use the option to show the bandwidth I got an NaN kbps...

why is that?

@Dustin: Ah, not good...

@ Andy,
Thanks for your post on CloudBerry Explorer and your explanations on your site.

Mike.

I'm trying to stream via cloudfront with a playlist of mp3 mixes.

Should the 'streamer' variable have the 2-part parameter or just the streaming-server part?
(and also, or not) With the 'playlistfile' variable having the full path or just the local filename?

so.addVariable('streamer','rtmp://streaming.mydomain.com/cfx/st&http://mybucket.s3.amazonaws.com/tld/2009/playlist.xml');

so.addVariable('playlistfile','http://mybucket.s3.amazonaws.com/path/playlist.xml');

I've also got cloudfront.mydomain.com (obviously 'mydomain' is not the real one) set for download, so that can replace the bucket url...

Then as I understand it the playlist.xml file is supposed to have just the filename in the location field as the server/player already knows it's supposed to be streaming it.
Does that sound right?

Post new comment

  • Allowed HTML tags: <code> <blockquote> <em> <strong> <strike> <ul> <li> <ol>
  • Lines and paragraphs break automatically.
  • You may post code using <code>...</code> (generic).

More information about formatting options