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
Configuring source encoding presets Calculating source encoding presets
Source encode cheat sheet
Testing your encoding setup
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 format - H.264
- 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|
|1024x576||Wide Super VGA (WSVGA)|
|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, or 96 Kbps or 128 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.
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.
- If you're sending a backup source encode, factor in 50% more data.
- Allow 40% of your total bandwidth for overhead.
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.
|Maximum video bitrate||400 Kbps||700 Kbps||1200 Kbps||2000 Kbps||4000 Kbps||6000 Kbps||20,000 Kbps|
|Recommended video bitrate||256 Kbps||512 Kbps||1024 Kbps||1600 Kbps||2640 Kbps||4400 Kbps||12,000 Kbps|
|Minimum video bitrate||128 Kbps||300 Kbps||400 Kbps||512 Kbps||1600 Kbps||3200 Kbps||8000 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.
If you're having problems or want to discuss this article, post in our forum.