Configuring Your Video Streams

We talked before about the two paths you can take towards configuring your video streams. One is driven by budget where cost issues dictate data rate. This case applies primarily to broadcast, subscription and pay-per-view and other high volume sites. In these cases, first you choose the data rate that matches your budget, then the appropriate resolution. 

The other path applies to sites where bandwidth costs aren't significant, mostly likely because stream counts are relatively low by broadcast standards. In these cases, you should choose a resolution first, then choose a data rate. We know all the basics, so let's apply them to these two cases. 

Data Rate Known, Choose Resolution

In this case, you know your data rate; it's the one that you must use to keep the site in the black. Your job is to find the appropriate resolution and frame rate for the video. As we've discussed, in my view, frame rate is easy; you should always use the frame rate in the source content. To find the resolution, take these steps. 

1. Choose a resolution using the bits-per-pixel value. Assess your content. If it's simple talking-head video, start with a bits-per-pixel value of .1; if harder-to-compress high-motion or detailed content, use .15. For this example, I'll work with a target bits-per-pixel value of .1, a budget-dictated data rate of 700 kbps, a frame rate of 29.97 fps and a 16:9 aspect ratio. This is going to sound math intensive here, but it's really pretty simple, so bear with me. 

a. Compute total pixels in the video. Divide the data rate (700,000) by the target bits per pixel value (.1). The result is 7,000,000 pixels per second.

b. Compute total pixels in the each frame. Divide total pixels (7,000,000) by frame rate (29.97) to get to 233,567.

c. Compute resolution from total pixels. Now we have to compute the actual resolution from the total pixels. Unless you're conversant with square root calculations, the easiest way to do this is to check the chart in Table 5 for the total pixels in the relevant aspect ratio. In this case, we have a near-perfect match, with our computed value of 233,567 very close to the 230,400 product of the 640x360 resolution in the 16:9 columns. If you're not so lucky, check the spreadsheet here, which contains a lot more values. 

table total pixels2.png

Table 5. Total pixels in common 16:9 and 4:3 resolutions. 

The Mod values shown in the chart represent the largest number that divides evenly into both the width and height of each particular resolution. To explain, the H.264 codec divides each frame into 16x16 blocks during encoding, so Mod-16 is the most efficient value. I'm not a Mod-16 snob; as you can see, the most commonly used resolution today, 640x360, is Mod 8, which means that 8 divides evenly into the height and width. Still, at lower resolutions, I would avoid Mod 2 and Mod 4 resolutions since these are least efficient, and the potential loss in quality has the most impact at lower resolutions. 

2. Encode at those parameters. Now that you know the resolution, frame rate and data rate, encode some test videos. 

3. Examine videos for noticeable artifacts. Remember, bit-per-pixel values are only a rough guide. If you see the types of artifacts that Knoche warned us about, like noticeable artifacts in text, faces or other sharp detail, you may want to consider encoding at a slightly lower resolution to improve quality. Or, if the video looks great, you may want to try a higher resolution. Repeat as necessary until you reach an acceptable quality of video. 

OK, this is the first data-rate driven case, now let's look at the resolution-driven case. 

Resolution Known, Choose a Data Rate

This is a case where you choose a resolution based upon the criteria discussed here, now you have to choose a data rate. As with the data-rate driven example, first we'll do the math to choose a data rate, then encode some test files, then examine them for artifacts. 

1. Compute the required data rate. Compute total pixels per second first, which is width x height x frame rate. Let's assume we've decided to go big with a case study that we're shooting at 24p. We'll encode at 1280x720x24 fps, which gives us 22,118,400 pixels per second. The content in my case study is relatively high motion, so I'll use a bits-per-pixel value of .15. To compute the data rate, multiple the number of pixels times the bits-per-pixel value (22,118,400 x .15) to get to a computed value of 3.317 Mbps. 

Because of the rule of .75, the computed data rate will probably be too high, but it's a good starting point. If you want to shorten your experimentation, my book Video Compression for Adobe Flash, Apple Devices and HTML5 has tables that incorporate the rule of .75 for common 4:3 and 16:9 resolutions produced at 24, 25 and 29.97 frames per second. In the book, you can choose a resolution and the table will show the data rate to use, or vice versa. For example, with these parameters (high-motion video, 720p, 24 fps), the 24p table suggests starting at 2.35 Mbps. 

2. Encode at those parameters. Now that you know the resolution, frame rate and data rate, encode some test videos. 

3. Examine videos for noticeable artifacts. Remember, bit-per-pixel are only a rough guide. If you see the types of artifacts that Knoche warned us about, like noticeable artifacts in text, faces or other sharp detail, you may want to consider encoding at a higher data rate to improve quality. Or, if the video looks great, you may want to try a lower data rate. Repeat as necessary until you reach an acceptable quality of video.

4.  Assess computed data rate for reasonableness. If your data rate is over 2.5 Mbps, and you're distributing only a single stream, consider whether your target viewer can download and play the video. The highest data rate that I saw in my last survey was Apple's 3.174 Mbps for the iPhone 4S video. Apple is obviously targeting a pretty tony group, but that's still quite high, particularly for an 848x480 video. The next highest data rate was Burberry at 2.2 Mbps for a 720p video. (OK, Dr. Pepper was at 2.5 Mbps, but that was for 612x344 resolution, which is clearly out of line). 

You know your audience demographic better than I do. If it's Joe Sixpack, you should make some conservative estimates of their effective bandwidth, and reduce resolution to arrive at a reasonable data rate target. If it's Daddy Warbucks, or the Housewives of Beverly Hills, you can be more aggressive with data rate. 

OK, almost home. Let's take a quick look at the audio side of the equation. 

Getting Started

Choosing your Frame Rate

Choosing your Video Resolution

Choosing your Data Rate

Configuring your Video Streams

What About Audio?


Comments (3)

Said this on 9-13-2012 At 01:21 am

Thanks for publishing this stuff. Still being read. I guess most don't have the courtesy to thank and comment. You got my email, I did sub. I was looking for what I needed to create a transparent background for HTML5...I think it is.

You know "a walk on actor" onto a website without seeing the player or needing one. One only sees a play button and the rest is transparent, so the web page is not blocked out nor is there any solid background when exporting the video.

If you write, or wrote about what type of program One needs to export a keyed actor, so that it comes out with an 'alpha background' please send me the link to the article. Thanks again for this valuable info, you are appreciated.

Regards

Si

Nigel
Said this on 9-1-2013 At 02:42 pm

Fantasticly good review. Thanks

Jan
Said this on 9-3-2013 At 07:47 am
Nigel:

Glad you found it useful, thanks for sharing.

Jan
Post a Comment
* Your Name:
* Your Email:
(not publicly displayed)
Reply Notification:
Approval Notification:
Website:
* Security Image:
Security Image Generate new
Copy the numbers and letters from the security image:
* Message: