Did you know you can do live streaming (including iOS and Android/BlackBerry mobile devices) for under $20/month?
Blane Young wrote a great article on Launching an Internet Campus On A Shoestring Budget. The most expensive component of that writeup was $75/month for a video streaming provider.
That got me thinking about how to do it for less.
This article aims to show you how to do just that using Amazon EC2 and the Wowza Media Server.
Download this spreadsheet to estimate your monthly cost (edit the values in green). There’s also a read-only version online.
Ready?
Overview:
- There Are Definitely Pros and Cons
- How to Setup Amazon EC2 and Wowza Media Server
- Accessing Your Stream
- Final Words
- More Info
Ready?
There Are Definitely Pros and Cons
Pros #1: It’s cheaper. Amazon EC2 only charges for what you actually use.
Most streaming media providers charge a fixed monthly rate for a certain amount of storage and bandwidth. For example, Light Cast Media’s Starter plan gives you 5 GB of storage and 100 GB of bandwidth.
If you only use 10 GB of bandwidth, you still pay $75/month whereas Amazon EC2 would only charge you for 10 GB (at a ridiculously cheap 15 cents a gig!).
So the 100 GB you’re getting from Light Cast Media would only cost you $15 with EC2/Wowza!
Pros #2: Lets you use any video player which supports live streaming.
Sexy is not a word I would use to describe video players from streaming media providers. By using EC2 and Wowza you’re free to choose whichever video player you’d like.
Flowplayer and JW Player are the two most popular open source players.
JW Player has more (and better looking) skins while Flowplayer gives you more control of what buttons show where.
Cons #1: More technical to setup and manage.
The good news is this post should make the initial setup easier. π
Cons #2: No built-in analytics.
Generally streaming media providers provide basic reporting of how many people watched the stream and from where.
Unfortunately, since we’re handing the streaming on our own, there’s no analytics baked in.
But! Both Flowplayer and JW Player provide ways to tie Google Analytics in. So with a bit more setup you can get usable reporting.
Another option would be using a real-time analytics service like Woopra.
Cons #3: It’s not a true content delivery network (CDN).
A CDN takes your live stream and distributes it across it’s network. Generally this is multiple places within the United States and a few overseas locations.
When a viewer connects to your stream they will be delivered the closest stream from within the CDN’s network. This ensures less delay and buffering problems with the video.
With the EC2/Wowza setup there’s only one server so you don’t get the benefits of a CDN.
However, at an entry level Internet Campus most of your users will be watching from near your broadcast location anyway. Since your visitors aren’t as globally scattered this is less of a problem.
Cons #4: Doesn’t support simulated live services.
Simulated live services means you’re not streaming live, but at a set time later on. Let’s say 9 PM EST the day after the service. In a simulated live service, if someone comes at 9:15 PM they would start watching 15 minutes into the service and not at the start.
Out of the box this is not possible. But it is doable with some code mojo.
Perhaps I’ll detail that in another post . . .
How to Setup Amazon EC2 and Wowza Media Server
Do the pros outweigh the cons? If so, let’s get on with how to set things up!
Create an Amazon EC2 Account
Be sure you have a credit card handy and create your Amazon EC2 account.
Activate Your Wowza Subscription
This is $5/month. When you active your subscription you will be charged a pro-rated amount for the first month.
Install Firefox
There’s an ubercool Firefox add-on that makes creating/managing Amazon EC2 instances super easy. So if you don’t have Firefox already installed be sure you download and install it.
Install Elasticfox Add-on
Now download/install the Elasticfox add-on. If Firefox asks you to Open or Save the add-on, choose Open and select Firefox as the program to open with.
Create and Start a Wowza Media Server Instance
Once Firefox has restarted we’re going to use Elasticfox to create and start an Amazon EC2 instance with the Wowza Media Server pre-installed and configured.
1. Launch Elasticfox.
Be sure Firefox is running and go to Tools
| Elasticfox
.
2. Give Elasticfox permissions to access your Amazon EC2 account.
The first time you run Elasticfox you’ll see this question. Click Yes
.
Then enter your Account Name (whatever you want to call it) and the Access Key ID/Secret Access Key.
The Access Key ID and Secret Access Key can be found in your Amazon Web Services (AWS) account which you created when you signed up for Amazon EC2.
If you don’t see an Access Key ID listed, click “Create a new Access Key.”
Once you’ve filled this out, click Add
then Close
.
3. Close and restart Firefox/Elasticfox.
4. Choose the best location to stream from.
Within the Regions dropdown in Elasticfox, choose the region closest to your streaming location.
5. Launch a Wowza Streaming Server instance.
Visit the Wowza EC2 Support page and copy the AMI ID (32-bit option) from the region that corresponds to the one you selected above.
Now click the Images tab within Elasticfox and paste the AMI ID into the text box. This should filter out all images except one.
Right-click the matching image and click Launch instance(s) of this AMI
. On the screen that pops up, click Launch
.
6. Make the server publicly accessible.
Click on the Security Groups tab in Elasticfox. In the Group Permissions section on the right click the green checkmark icon and mirror the settings in the image below.
Click Add
.
7. Make sure things are up and running.
By now your instance should be running (it usually takes a few minutes).
Click on the Instances tab in Elasticfox and ensure the State column says running. Once it does, right-click the instance and select Copy Public DNS Name to clipboard
.
Open a new browser window and visit http://PUBLIC_DNS_NAME:1935
replacing PUBLIC_DNS_NAME
with the one you just copied.
If everything is configured correctly you should see something similar to this.
Install Flash Media Live Encoder (FMLE)
Head on over to Adobe’s site and download the Flash Media Live Encoder. They make you create an account. Boo!
Configure FMLE and Start Streaming
1. Launch FMLE.
2. Setup a streaming profile.
Mirror the video and audio settings below. Keep in mind your video/audio device will be different depending on your capture card.
Under the video section, click the wrench icon next to H.264. Be sure Profile is set to Baseline and the Level is 3.0 or above. This ensures iOS streaming will work.
Copy the Public DNS Name again from Elasticfox.
In the FMS URL box, type in rtmp://PUBLIC_DNS_NAME/live
replacing PUBLIC_DNS_NAME
with the one you just copied. And then specify a stream name (it can be anything, mine happens to be “stream”).
Uncheck “Save to File.”
Now click File
| Save Profile
in FMLE and save this profile somewhere on your computer. If the settings get changed, you can go to File
| Open Profile
and have the settings re-populated for you.
3. Start streaming!
Click the giant, green Start
button. π
When you’re done with the service/stream, just click Stop
in FMLE and then right-click the instance in Elasticfox and choose Terminate
. No need to have the instance running when you’re not streaming. This saves you money!
Accessing Your Stream
Flowplayer/JW Player (or similar)
You will need the FMS URL and Stream Name found in FMLE. As an example, let’s test and make sure your stream is working properly.
Copy the following address.
http://developer.longtailvideo.com/trac/testing/?player=5.2&skin=beelden&file=STREAM_NAME&streamer=FMS_URL&controlbar=over&height=270&width=480&autostart=true
Replace STREAM_NAME
and FMS_URL
with the values from FMLE.
Now visit that address in your browser. You should see your video playing back. If so, congratulations!
For mobile devices the address will be different (depending on the type of device). You will still need the STREAM_NAME
from FMLE, but instead of the FMS_URL
you will need the Public DNS Name from Elasticfox.
iOS Devices
http://PUBLIC_DNS_NAME:1935/live/STREAM_NAME/playlist.m3u8
Android/BlackBerry
rtsp://PUBLIC_DNS_NAME:1935/live/STREAM_NAME
(notice the URL starts with RTSP and not RTMP or HTTP).
I’ve heard rumors Android doesn’t support MP3 audio (only AAC). I’ve also heard direct links don’t work in Android. So you can’t type the RTSP link directly into the browser; you have to create a page with the link and click the link from the browser.
Can anyone confirm or deny these rumors?
Final Words
Hopefully this guide gets you up and running.
If you have any questions, please give me a holler in the comments! Also, let me know your tweaks/suggestions, if you plan on (or are using) this in a production environment, etc.
Curious to know what the pros and cons are for you . . .
Josh collesano says
We just streamed our fall retreat weekend live for free. And integrated my iPhones camera for a wireless POV cam sync’d to the system. I’ll post details after this weekends fall retreat which we will be streaming at Ustream.tv/channel/fallretreat2010 in case u wanna see.
Hint: we used FMLE, a dedicated mix from out M7.
Alex Tran says
Sweet use of the iPhone!
Chris Leversuch says
Wow, deja vu π I wrote a very similar (although less detailed) post exactly on this subject myself about a week ago – http://basement.cck.org.uk/live-streaming-how-we-did-it/
We’ve now streamed our evening meeting twice with great success.
I posted a follow-up post earlier today about how we wired up our hardware – http://basement.cck.org.uk/live-streaming-part-2-signal-path/ (yes, shameless plug π )
Chris Leversuch says
Forgot to ask – have you tried connecting to the stream with an iPhone 3G?
According to http://www.wowzamedia.com/forums/showthread.php?9081-quot-this-movie-format-is-not-supported-quot-iPhone-3g-error the H.264 settings need to be Baseline 3.0 for a 3G to work. I’m currently using 3.1 and we get an error about the movie format not being supported. I’ll try 3.0 next time.
Alex Tran says
Ahh, interesting. We had problems with iPhone 3G. I hadn’t looked into it, but I will try using Baseline 3.0 to see if that solves it.
iOS streaming has been flawless (3GS/4). This is where the closed nature of Apple wins out. π
We’ve run into issues with Android/BlackBerry. Some Android/BlackBerry devices work and others don’t. Those that work have varying levels of streaming quality.
So troubleshooting mobile compatibility is a time consuming task.
Alex Tran says
I just did a test with Baseline 3.0 (instead of the default 3.1) and iPhone 3G streaming worked!
Thanks for pointing that out!
Ian Beyer says
As of iOS 4, you can use Main. Android still doesn’t handle anything more than Baseline, however.
Dano Hart says
I’ve gotten a church account on watershed.ustream.tv so it is ad free and it is good. It is also “pay what you use”. It is the best month to month pay as you go streaming service with amazing benefits. I need android and iPhone support, and ustream already has that through their apps so it works very well.
Alex Tran says
Nice. I hadn’t seen Watershed before.
I dig the pay-as-you-go option. But looking at the pricing they are extremely expensive at $1.00 per viewer hour (under 1000 hours a month). So under the same scenario as this post (50 viewers per week watching a 75 minute service) it would cost $270 with Watershed versus $20 with EC2/Wowza.
Granted, Watershed does provide many more features . . .
Still a great service to keep in mind if you’re looking for something quick and easy.
Ryan says
Thanks for the post.
I’m having difficulty getting my instance started. When I right-click and attempt to ‘launch’ I get and error stating ‘Subscription to ProductCode 8ED157F9 required.
Anybody?
Ryan says
Oops… never mind. Skipped a step above.
Alex Tran says
Hehe. I know there were a lot of steps. Easy to miss.
When you get it up and running, would love to hear how it goes! What do you think of the setup? Usable in a production environment for you?
Alex Tran says
After you signed up for an EC2 account, did you activate your subscription?
From the error, it seems like that may be the cause of your hiccup.
Ryan says
Okay, new problem.
I’ve tried testing my stream, but another error…
Task queue failed at step 5…
Phill Tran says
Great post.
Amazon is offering free AWS for a year to make the deal a little free-er.
http://amzn.to/aswfree
“To help new AWS customers get started in the cloud, AWS is introducing a new free usage tier. Beginning November 1, new AWS customers will be able to run a free Amazon EC2 Micro Instance for a year, while also leveraging a new free usage tier for Amazon S3, Amazon Elastic Block Store, Amazon Elastic Load Balancing, and AWS data transfer. AWSβs free usage tier can be used for anything you want to run in the cloud: launch new applications, test existing applications in the cloud, or simply gain hands-on experience with AWS.”
Alex Tran says
Link broken for anyone else? If so, try this one: AWS Free Usage Tier.
Thanks for the tip! It doesn’t look like this will reduce the overall cost for live streaming, but you can’t go wrong with free. π
I know I will be signing up for the free storage (Amazon S3). And the EC2 Micro instance will be fun to play around with.
Phill Tran says
Thanks for the fixed link.
Art Upton says
Alex,
Your directions were perfect — BUT I got down to the VERY LAST STEP of clicking the big green START button, and got an error from FMLE that said: “Invalid Primary FMS URL Please enter Primary URL in rtmp[t]://hostname:[portno]/ applicationpath format. Special characters in URL are not allowed.”
What happened!? Thanks so much — au
Alex Tran says
Hiya Art!
I would double check what you have typed out in FMLE under the FMS URL section. Be sure it’s in this format:
rtmp://PUBLIC_DNS_NAME/live
For example:
rtmp://ec2-184-72-80-190.compute-1.amazonaws.com/live
Double check the URL begins with RTMP, that you’ve copied the Public DNS Name (versus the Private DNS Name) and it ends with /live.
Art Upton says
Thanks, A!
I appreciate the quick response. I tweaked per your note, and it now it works like a charm!! Keep up the great work.
peas 2u!
art
Djs says
Check out RackSpaceCloud.com as an alternative to Amazon. Their cloudfiles are on a true CDN and their dedicated server options start at $10/month. Small volume churches should be able to use the $10/month server size of 256MB.
Jonathan Dolan says
Thanks for your detailed instructions! However, I’m having an issue setting this up. When I get to step 7 and attempt to check my Instance I get a page in Firefox that says “The connection has timed out.” My Instance address is http://ec2-50-16-3-101.compute-1.amazonaws.com:1935
Can you help?
Jonathan Dolan says
Well, I figured out what was wrong with my Instance. After digging into the Wowza Quick Start Guide a little more I went through all the steps again. What I did differently was in Step 6. I deleted the original Group Permission that I’d created and created a new one after making sure that I had my default Group selected (on the left side). My instance works now at least.
I tested my stream, and it works on http://developer.longtailvideo.com/trac/testing/?player=5.2&skin=beelden&file=stream&streamer=rtmp://ec2-50-16-11-124.compute-1.amazonaws.com/live&controlbar=over&height=270&width=480&autostart=true
Do you have any advice on setting up a streaming player in WordPress?
Alex Tran says
Eek! I had posted a reply to you earlier, but I’m not seeing it.
Glad you got it working on your own. Mad props for reading through the Quick Start Guide yourself. π
As for getting incorporating streaming video within WordPress, you can try using the JW Player Plugin.
It’s the same video player you used to test the stream.
Ian Beyer says
JW Player has a wordpress plugin that should make it really easy to embed.
Jonathan Dolan says
Thank you for the detailed instructions. However, when I get to step 7, my browser tells me that the server isn’t responding. My address is http://ec2-50-16-3-101.compute-1.amazonaws.com:1935. Any help would be appreciated! Thanks.
Jonathan Dolan says
Yeah, reading anything in that Wowza manual is only for the brave at heart. Haha. I didn’t understand any more than half of what I was reading, but I hoped that I would find a clue of what I had done wrong! I’m checkin out the JW Player plugin now and will let you know how it goes. Thanks!
Jonathan Dolan says
Ok. I got it working, finally! Two helpful things were:
1. The JW Player plugin for WordPress
2. This support page from JW Player – http://www.longtailvideo.com/support/addons/jw-player-plugin-for-wordpress/11913/jw-player-plugin-for-wordpress-shortcode-examples
Now, I’m looking for a good countdown plugin that would automatically count down to our next streaming service. Any ideas?
Stuart Smith says
I know this was a while ago – I don’t suppose you know the shortcode you used to get this working? I’ve tried a variety of combinations but no joy π
Stuart Smith says
Just figured it out π
You use something like :
[jwplayer file=”livestream” streamer=”rtmp://ec2-79-125-58-45.eu-west-1.compute.amazonaws.com/live” provider=”rtmp”]
replace livestream with the name of the stream you have set up in adobe media encoder, and use your url for the other part
Jonathan Dolan says
I have one more question. Is it possible to connect to the same instance when you get ready to stream again. It seems that I have to copy the Public DNS of my new server instance and paste it into FMLE and my website each time I stream. Is there a way around this? If not, it’s a big caveat to this way of streaming.
Jonathan Dolan says
Is this still working for you? I am going to have to move to a different solution, I think. It ends up being $100/mo just to run the instance if I can’t simply start and stop it.
Alex Tran says
Yeah, unfortunately you bring up a good point.
Because the DNS name changes each time you create a new instance, there is a bit more work that needs to be done updating it each time.
One possible work around is creating a CNAME on your domain that points to the Public DNS name.
So, for example, you create a sub-domain live.churchname.com and point it to the Public DNS.
Then you can use live.churchname.com within FMLE and your website. You would just need to update the DNS record each time you create a new instance. Be sure you set the TTL to a low value to ensure it propagates quickly enough before people try to connect.
Another solution would be utilizing Amazon’s Elastic IP Addresses which is designed for this particular type of situation. This service lets you reserve a static IP and attach it to instances which have varying IP/Public DNS Names.
You pay 1 cent/hour whenever an instance is not running. So at most you pay $7.44 per month extra for this feature.
I’ve never done this before, so that would be an extra credit homework assignment. π
Hope this helps.
Chris says
I must be totally missing the part about how to embed into your site. I am trying to us JW Player, but I can’t seem to get the live stream to work. JW Player works fine if I specify an actual .mp4 video, but I can’t seem to figure out the rtmp streamer part. Can anyone help?!
Alex Tran says
How are you publishing your live stream? Are you using FMLE/Wowza method from this post?
Also, have you read the JW Player documentation on RTMP streaming?
Chris says
Yes, I’m using the FMLE/Wowza method, along with the Elastic IP suggestion.
I got it working on my site using the method. Not my first preference, but my site does not like the javascript for some reason. I just included links to the iOS and Android/Blackberry stream within the tag, so it won’t be seen unless the user does not have flash.
It works great on iOS devices, but I cant seem to get the rtsp stream to work on the Android OS.
iOS: http://ec2-50-18-52-19.us-west-1.compute.amazonaws.com:1935/live/fbclubbock/playlist.m3u8
Android: rtsp://ec2-50-18-52-19.us-west-1.compute.amazonaws.com:1935/live/fbclubbock/
shawn says
The Android devices need “RockPlayer Lite” installed to work with the stream for Android mentioned above. The audio sounded a bit choppy in my test, but better than nothing I guess.. Let me know if you’re able to try this out too!
Ian Beyer says
Most android devices will handle the Flash directly, and as of 2.3 can also handle the Apple HLS stream.
Ian B says
(Although I will add the caveat that while it is technically supported in Android OS after 2.3, whether or not it works consistently and reliably is still very much up in the air as of 4.1)
christian says
Thanks for a great post. Everything works even with the elastic ip, that was very easy to set up. However I am starting to worry a bit. Is it not possible for other people to stream to my instance? I mean once i start streaming there is no request for a password. I have tried to search for a solution but everything i find is not written for regular people. Any thoughts?
Best regards,
Christian
Alex Tran says
that’s great you were able to get everything working (even the elastic IP)!
what you’ll have to do is install the MediaSecurity package for Wowza.
in the zip file there will be a guide. the section titled ModuleRTMPAuthentication is what you’re looking for. that’ll at least get you started in the right direction. beware, i haven’t implemented this before so your guess is as good as mine if you run into any problems.
Kris says
Thanks for the guide,
saved my gig, I was wondering how many people can watch the stream, what happens if there are lets say 1000 clients streaming at the same time? Do you have any experience you can share?
Kris
Ian Beyer says
Depends more on bandwidth than actual connections. You can set up a repeater system or spin up some really big instances. Check my blog for more. (see link above)
Ben Watson says
I think we may be experiencing this problem… the last few weeks, we get an error that says:
Connection failed: Over license connection limit.
Which is weird, since it’s suppose to be unlimited. I started a larger instance, and it worked for a little bit, then same thing…
Started a LARGE instance, and now it seems to be working… I’m going to call wowsa tomorrow to see if there is something else I can do, but it’s frustrating when it croaks on a sunday morning!
Ian B says
There’s a simple answer there…
It sounds like you’re using a “lickey” AMI, which requires you to provide your own license and will use a developer license (with a 10 connection limit) until you do. What you need is the “Devpay” AMI or a Marketplace AMI with an embedded license.
What AMI are you using?
Eugen says
I’m not sure I understand what wowza does. Does it take a stream, transcodes, and sends it to Amazon, and then Amazon, in turn, sends it to the user?
Where does the FMLE come into the picture? Why use Wowza and FMLE? Don’t they do the same thing?
Ian B says
FMLE creates the stream, Wowza distributes it.
Sloan says
Hi,
I’d love to know if you are available to help consult our church to set up a DVR’d live stream using Wowza?
Let me know.
Thanks!
Sloan
Ian B says
You bet. Drop me a line at [email protected]
Shawn says
Anyone using auto launching instances with elastic ip association? I received an email regarding automation of EC2 instances, but haven’t chased down the 411 yet.
Ian B says
You can sort of automate it, but you have to script it. The API doesn’t currently allow for assigning an ElasticIP on startup, so you have to check the status and once it’s running, associate the IP.
Bog says
Would this setup be able to support transcoding so that I can send up only 1 stream to EC2 and then have a mobile & desktop stream be made available?
Richy says
Hello,
Thanks for the detailed information, I did everything as suiggested on the steps above. I can connect to using FME and broadcast without issues but my problem is not being able to play the video.I tried using longtailvideo wizrad and it wouldn’t work. I keep getting “cannot connect to server” error message.
The only thing coming to my mind right now is maybe i’ve done or configured something incorrectly on Secrity group, below is the screenshot of my security group. is there anything wrong there?
http://mcubemedia.com/ask.png
also my FMS url is
rtmp://ec2-54-242-50-97.compute-1.amazonaws.com:1935/live
I will appreciate your help
Thanks
Jonathan says
On the LongTail Video Player wizard, you need to give it the address of your actual video file stream. See this page: http://www.longtailvideo.com/support/jw-player/28854/using-rtmp-streaming. This is an example of what you’ll use from that page – rtmp://example.com/application/mp4:myVideo. This is what I put in that field to make it work – rtmp://stream.cwebtv.net/mbm1/mp4:mbm1.
Hriday says
Earlier in the page, you mentioned that you can download the Amazon EC2 estimate spreadsheet. But I can not find a link to download. It does have link to Readonly version
Can you provide link to download Amazon EC2 estimate spreadsheet?
Tim Schmoyer says
This step-by-step is wonderful.
On Feb 21, 2014, Wowza released Engine 4 and these instructions no longer work.
Could you help out? or update this post?
thanks for your service to all of us!
Ian Beyer says
In general, it’s not much different with version 4.0. Out of the box, the live, vod, and vods3 applications are the default. You will now require a username and password to publish to the live application (this has been the case since 3.6, I think). Other than that, you should still be able to use the method shown above.
username: wowza
password:
This password combo is also used for the web-based streaming engine manager (http://:8088) and other areas where a password is required (such as the various things on port 8086 that have been there for some time).
Ian Beyer says
OK, looks like wordpress ate the password because I put it in brackets. The default password for most Wowza EC2 things is the instance ID (will look like “i-aa82b28b”) and can be obtained from the console.
Tim Schmoyer says
Ian,
Thanks so much! this resolved my connection issues with Engine 4 straight away.
We have been using Wowza/Amazon EC2 for a year now and have never had to add login credentials.
Thanks again.
Tim Schmoyer
Ian Beyer says
They started adding those in the v3 images, starting with the admin-digest credentials for the streammanager and stats section.
WSE v4 makes the overall process a lot easier, and it’s going to be great for churches.