If you're more familiar with IT infrastructure or video production technologies than with video encoding, creating high-quality streams may seem daunting. Learn how to create high-quality encoded source video for the Wowza Streaming Cloud™ service.
About encoding source video
When using Wowza Streaming Cloud, you create one bitrate rendition, also called a source encode, of the stream you're publishing to Wowza Streaming Cloud. This is the master bitrate rendition, if you will. Wowza Streaming Cloud uses the master rendition to create one or more renditions of equal or smaller size that it delivers to your audience. In other words, Wowza Streaming Cloud transcodes the stream and creates multiple, keyframe-aligned, adaptive bitrate output renditions that play seamlessly regardless of where the audience is watching, or what device or connectivity they're using.
Creating source encoding presets is a balancing act, a tradeoff between quality and bandwidth. Of course you want to create the best possible quality source encode, but higher quality means more data, and the stream size is limited by the bandwidth you have to transmit the encode from your encoder to Wowza Streaming Cloud.
Configuring source encoding presets
Since you only send one—count 'em, one—source encode to Wowza Streaming Cloud, make it a good one. As the old adage goes, garbage in, garbage out: Wowza Streaming Cloud can't generate any output renditions that are of higher quality than what it receives from the video source.
With the basic live stream workflow, Wowza Streaming Cloud creates output renditions automatically based on the resolution of source video. The higher the resolution of the source video, the more output renditions Wowza Streaming Cloud transcodes. You can edit or remove renditions in the Wowza Streaming Cloud advanced mode, but generally speaking, you should prepare a source encode that allows Wowza Streaming Cloud to automatically deliver suitable, high-quality streams across any kind of client connection, to any device.
In your camera or source encoder, you'll be able to configure some or all of the attributes described here. Use these guidelines to help you create high-quality encoding presets tailored for streaming live events using Wowza Streaming Cloud.
H.264 encoding presets can be contained in any of several types of wrapper—.MP4, .F4V, and others. Wowza Streaming Cloud accepts H.264-encoded content in an MP4 container for live streams.
- Accepted encode formats -
- H.264, 4.1 for up to 1080p 30 fps
- H.264, 4.2 for 1080p 60 fps (HLS streams only)
- Accepted audio formats - AAC, MP3
- Accepted container - MP4
- Frame size refers to the dimensions, or the width and height, of the video frame, measured in pixels. Width comes first, followed by height: The frame size 640x480 is 640 pixels wide by 480 pixels high.
Resolution is often used interchangeably with frame size, but it's not the same thing. Resolution is the total number of pixels in a frame: the width times the height of the frame. The resolution of a 640x480 frame is 307,200 pixels. Higher resolutions mean sharper images.
- Aspect ratio is the width of the video frame divided by its height. The aspect ratio of a 640x480 frame is 1.33 or, when expressed as a proportion of width to height, 4:3 (the frame contains 4 vertical lines for every 3 horizontal lines).
Two aspect ratios are commonly used in video streaming: 4:3, which was the standard for traditional CRT television sets and is still used by DVDs; and 16:9, which is the newer, widescreen aspect ratio used with high-definition (HD) playback.
High-definition video is considered any 16:9 video whose frame height is 720 pixels or higher—in other words, 1280x720 or 1920x1080 pixels. Standard-definition video has a 4:3 aspect ratio and a frame height of 480 pixels (640x480).
Some common aspect ratios for source video include:
|Aspect Ratio||Frame Size||Often Called|
|16:9||3840x2160||4K UHD, Ultra HD (UHD), UHDTV-1, 2160p|
|1920x1080||Full HD (FHD), 1080p, or 1080i|
|1280x720||HD or 720p|
|854x480||Full Wide Video Graphics Array (FWVGA)|
|4:3||800x600||Super VGA (SVGA)|
|320x240||Quarter VGA (QVGA)|
When specifying the aspect ratio in your source encoder, use the same one that you intend to deliver to viewers, either 16:9 or 4:3. Otherwise, the video will be cropped or stretched in the player. Then, choose a frame size that corresponds to the aspect ratio.
Encoders compress video using 16x16-pixel blocks. For the most efficient encoding, make sure the frame width and height are divisible by 16, or at least by 8.
Bits per pixel - The number of bits per pixel varies depending on the content of the video. The more motion and action in the stream, the more bits per pixel you need and the less compression can be performed. Bits per pixel typically range from 0.10 for limited action content to 0.15 for high motion, complex action.
Again, a higher bitrate can contain more data, but you must have the bandwidth to accommodate it. See Calculating source encoding presets.
Audio bitrate - The audio bitrate is the amount of data in 1 second of audio, also measured in Kbps. Audio bitrate can scale for bandwidth and device, too. Typical audio bitrates are 32 Kbps or 64 Kbps for voice content, and 96 Kbps, 128 Kbps, or 192 Kbps for music or more complex audio.
Frame rate - The number of frames in 1 second of video. The slower the frame rate, the lower the video quality. High-definition devices typically capture video at 30 or 60 frames per second (fps), but the standard for video streaming is 29.97 fps in the US and Japan, 25 fps in the rest of the world. By default, Wowza Streaming Cloud uses the source encode frame rate for all output renditions that it transcodes.
Keyframes - Keyframes mark the interval used to compress a group of video frames. Keyframe intervals, also called i-frame intervals, are also used as seek points in players. A seek point indicates where an adaptive bitrate rendition can be switched in a stream. For live streams, keyframe intervals should be 2 seconds, so if your frame rate is 30 fps, the keyframe interval will be 60 frames. Note that too many keyframes can result in poor (stuttered) playback.
Constant or variable bitrate - Constant bitrate (CBR) encoding is faster than variable bitrate (VBR) but results in lower-quality video in complex or high-motion content. VBR encoding adjusts the bitrate depending on the complexity of the content, which yields higher-quality playback. When using VBR for live streaming, constrain the data rate of VBR source encode to 110% of the target bitrate to avoid buffering or dropped frames.
Profile - The profile determines how the H.264 codec compresses the stream. Greater compression produces smaller streams; less compression generally means better quality. Profiles are based on the streaming application:
- Main is suited for standard-definition broadcast and desktop streaming.
- Baseline is suited for playback on mobile devices and for compatibility with older playback devices.
- High is geared for high-definition playback devices.
When choosing a profile for your source encode, consider how the majority of your viewers will ultimately watch your stream--don't use the High profile if your audience will be watching on their iPhones, but do remember that your source encode is your master bitrate rendition. Wowza Streaming Cloud generates its highest bitrate rendition directly from the source encode, so always prepare the best-quality source encode that you can.
Calculating source encoding presets
When preparing a source encode, use the following rules of thumb to make sure the size of the encode doesn't exceed your available bandwidth.
- Determine the bandwidth for your source encode.
- Allow 40% of your total bandwidth for overhead.
Say you have a 10 Mbps connection between your encoder and Wowza Streaming Cloud. Allowing 40% for overhead, your total encoding presets should not exceed 6 Mbps total, or 3 Mbps each. You could easily prepare a primary encode of 1080p quality (1920x1080) at the maximum video bitrate (6000 Kbps) with an audio bitrate of 128 Kbps.
Source encode cheat sheet
If you're not mathematically inclined—or you just want a good starting point—use the following recommended settings to create source encoding presets for Wowza Streaming Cloud.
|Supported video bitrate||300 - 700 Kbps||400 - 1200 Kbps||512 - 2000 Kbps||1600 - 4000 Kbps||3200 - 6000 Kbps||8000 - 20,000 Kbps|
|Recommended video bitrate||512 Kbps||1024 Kbps||1600 Kbps||2640 Kbps||4400 Kbps||12,000 Kbps|
Testing your encoding setup
After you've configured your encoder, test your setup to make sure that your live event runs smoothly. Under the Wowza Streaming Cloud standard plan, Wowza support offers a 48-hour turnaround during business hours (6am to 8pm Eastern time, excluding holidays), so make sure to test your entire setup at least three business days before your event. Testing your end-to-end setup a week ahead is even better, as it allows you time to troubleshoot and fix problems. To test your entire setup:
- Run the primary and backup encoders with a test stream for at least 30 minutes each.
- Preview the stream using the Wowza Streaming Cloud player on all kinds of screens and devices.
- View the stream on your Wowza Streaming Cloud hosted page, if you have one.
- View the stream on external players and websites, if you're using them.
- If you're recording, check that the recording captures supported audio and video as expected.
It's also a good idea, on the day of the event, to make sure your video source is ready to stream at least two hours before the scheduled start time, and to start the video source at least 15 minutes before the event begins.