Live Streaming Using Wowza EC2

Blog 5 min read | Feb 9, 2011 | JW Player

Share:

Publishing a few on-demand videos can be cheap and simple: just upload the videos to your site and use a tool like the JW Player to embed them on your site. Historically, publishing a live stream has been challenging and a lot more expensive. Most publishers use dedicated upload and streaming software for live streams, which can cost hundreds or even thousands of dollars and often require high cost server hardware. However, there are some cheap alternatives. This blog post explores a combination of tools that will allow you to get a live stream up and running for just a buck!

Wowza Media Server for EC2

First the server. There are various streaming servers out there: some have a license fee (Flash Media Server, Wowza Media Server) and some are free (IIS Media Services, Flumotion). For each of them, you’ll need to buy, install and run a webserver. This is a lot of work and costs a lot of money.

Enter Amazon EC2. It’s a service from Amazon that allows you to rent webservers by the hour (you also pay per GB transferred, but that’s just a few cents). The pre-built EC2 offerings include webservers that run Wowza Media Server 2.0. This means you can boot a webserver with Wowza, stream a live event, and terminate the webserver shortly afterwards. No monthly contracts, no server management.

Setting up a Wowza server takes about an hour the first time around, since you have to sign up for EC2 and ‘Wowza for EC2’ before you’re able to configure your server instance (which can be done using the ElasticFox Firefox plugin). When that’s done, booting your server for a live event takes a few clicks. See the Getting Started section at the Wowza Media Server for EC2 page and make sure to follow all steps.

Note you won’t have to access the webserver itself. Instead, the default Wowza installation boots up ready to broadcast a live stream – you’ll just need to connect to it. Also, be sure that you open TCP port 80 (HTTP) and 1935 (RTMP) to any IP (0.0.0.0/0) when configuring the “security group” permissions. Finally, make sure you terminate a server after you’ve finished your live event – the meter keeps ticking regardless of whether or not you’re using the box.

Boot a server instance and wait until ElasticFox says it is “Running”. You’re now ready to start the stream!

Flash Media Live Encoder

On to the tools for uploading the live stream. There are the expensive tools (Inlet, Telestream), there are the hard to use tools (VLC, FFmpeg), and then there’s Flash Media Live Encoder from Adobe. It is free and fairly easy to use. It is intended for use with the Flash Media Server, but works equally fine with the Wowza Media Server. Download the tool (available for Windows & Mac) to get started.

Once inside the tool, you’ll need to select a video capture device. This can be a built-in webcam, but you can also use a professional camera connected to your computer using USB or Firewire. On Windows, you can even stream your desktop after installing the VH Screen Capture driver. We recommend using the following settings:

  • Use H.264 as your video codec. Something in the range of 400 kbps will look great for a professional (640×360) broadcast. Something in the range of 200 kbps will be fine for a webcam-style (320×180 pixels) broadcast.
  • Use AAC as your audio codec. If you have a “pro” audio input, use e.g. stereo audio at a samplerate of 48 kHz and a bitrate of 64 kbps. Otherwise, use mono, 22 kHz and 48 kbps.
  • The “FMS URL” should be the link to your Wowza EC2 instance. It will look something like this: “rtmp://ec2-79-125-37-3.eu-west-1.compute.amazonaws.com/live”. The “rtmp://” lead and “/live” trail are always the same. If your server is running, you can press the “Connect” button right below to test the connection.
  • The “Stream” will be the name of your stream. Call it something like “mystream.mp4”, including the .mp4 extension to circumvent a few quirks in both the server and the player.

Press the green “Start” button and your stream is up and running. You’re now broadcasting!

JW Player

The last step is embedding a player on your site where viewers can watch your live event. The JW Player is an excellent (free for noncommercial use) option. Download the JW Player and upload the “jwplayer.js” and “player.swf” files to your website. You can now use the following code template to embed the live stream into your page:

  • JW Embedder

Make sure to update all the options in this code with your configuration. This includes:

  • The location of “jwplayer.js” and “player.swf” on your web server.
  • The “file” (same as the “Stream” in FMLE) and “streamer” (same as the “FMS URL” in FMLE).
  • The width, height and preview image (optional) that appears before a visitor clicks the play button.

Navigate to the web page where you’ve inserted the embed code and click on the player to watch the stream. You’re now live!

Next Steps

This tutorial has given you some hands-on tips for setting up a live stream in an easy and affordable way. Let us know if you run into issues, and we high recommend following the above instructions (especially the server setup and configuration) to the T!

Once you have your server up and running, it’s pretty simple to start adding other features, including:

  • Simultaneously streaming to Flash and the iPad/iPhone using the Wowza Server + JW
  • Using JavaScript to display a countdown before an event starts and a “replay” button for after the event ends.
  • Streaming your broadcast through Cloudfront (Amazon’s CDN offering), which allows you to broadcast a stream to a massive audience without worrying about scalability.

Also, feel free to post a comment below if you’d like to see any of these (or others) explored in a future blog post.