2009-05-10

H.264 encoding formula

Kush Amerasinghe, an engineer at Adobe has written an interesting primer on H.264 compression called "H.264 for the rest of us".
In this easy to understand paper he presents a very useful formula for estimating the video bitrate needed:

Bitrate [ kbps ] = Width * Height * fps * Motion * 0.07 / 1000

Width, height: Pixels
fps: Frames per second
Motion: Low = 1, Medium = 2, High = 4

Quote from the paper:

Low motion is a video that has minimal movement. For example, a person talking in front of a camera without moving much while the camera itself and the background is not moving at all.
Medium motion would be some degree of movement, but in a more predictable and orderly manner, which means some relatively slow camera and subject movements, but not many scene changes or cuts or sudden snap camera movements or zooms where the entire picture changes into something completely different instantaneously.
High motion would be something like the most challenging action movie trailer, where not only the movements are fast and unpredictable but the scenes also change very rapidly.

Example for a 25 fps video:
Low motion: 1280 x 720 x 25 * 1 * 0.07 / 1000 = app. 1500 kbps
Medium motion: 1280 x 720 x 25 * 2 * 0.07 / 1000 = app. 3000 kbps
High motion:1280 x 720 x 25 * 4 * 0.07 / 1000 = app. 6500 kbps