Modern video cameras support a wide range of video resolution and framerate settings. Streaming video over a network almost always requires video compression to reduce the bandwidth requirements, and the video encoder is usually configured with a bitrate setting. Determining the ideal settings for resolution, framerate and bitrate for a given application can be a challenge. This article presents a heuristic formula that can be useful in making that selection. Given a resolution and framerate, the heuristic will calculate the required bitrate.
The heuristic uses linear interpolation based on minimum and maximum settings for resolution and framerate. For this article, the minimum setting has a resolution of 160 x 120 pixels at 10 frames per second. The maximum setting is 1920 x 1080 at 30fps. The first step is to analyze these settings to determine a good bitrate for each. For this article, H.264 was used as the video encoder. Based on experiments, 50Kbps was selected for the minimum setting, and 4000Kbps was selected for the maximum setting.
Each combination of resolution and framerate can be characterized by multiplying the width, height and frames per second. The result represents the amount of un-compressed information being transferred each second. Using this method, the min and max settings are two points on a line. The equation for that line, based on the numbers in this article, is:
bitrate = (width * height * framerate) * 15.7 + 37800
This formula calculates the bitrate in bits per second (bps). To get kilo-bits per second (Kbps), divide by 1000. With this formula, it is possible to calculate a reasonable bitrate for any combination of resolution and framerate that falls within the min and max range.
The bitrate calculated by this heuristic would most likely be used to configure a video encoder. It could also be compared against the available bandwidth (if this information is known) to determine if sending the compressed video stream is possible. In general, a heuristic like this can reduce the amount of guess work when there are too many camera settings to analyze each one individually.