<< Animation: A New Computer | Home | Example JRuby Extension in Java >>

Notes on Video Encoding

Unit Conversions 

Kilobits per second Megabytes per minute Size of five minute film
2500 kbps 19.0 MB/min 94 MB
1500 kbps 11.3 MB/min 56 MB
800 kbps 6.0 MB/min 30 MB
500 kbps 3.8 MB/min 19 MB
250 kbps 1.9 MB/min 9 MB
150 kbps 1.1 MB/min 5 MB

Metric prefixes

Compression vs. Scaling

When compressing a video to low quality, quick downloading sizes, one may be tempted to first scale the video resolution down to a smaller size, say from 720x480 to 360x240, and then compress. However, if one considers the scaling operation a naive compression step, one must conclude that an intelligent compression algorithm should outperform the naive scaling in terms of quality vs. bitrate. If two videos are compressed to the same file size, then, if viewed at identical sizes, the video without the naive scaling step should be of higher quality. There is some question whether this is the case MPEG-1 Video as described later.

Images compressed and rescaled using two techniques.

The figure above shows two compression techniques using JPEG compression. The series on the left simply compresses the full size image. The series on the right first scales the image to half the original size, then compresses. Both are then displayed at the size of the original. Of course, the rescaling method has a large impact on the quality of the final image. A simple scaling gives a pixelated look, but cubic interpolation has a smoothing effect, possibly resulting in a superior look to unsmoothed blocking artifacts in the unscaled-compressed image.

One painful fact is that video software tends to play back videos in their native size. Thus an unscaled video will be viewed at full size, while the scaled video would be viewed at half size without action by the viewer. Given this, it's debatable whether a large display with visible artifacts, which may be invisible were the display size reduced, is superior to a small display with invisible artifacts that would be worse than those of the unscaled video if displayed at full size. In other words, from a purely technical standpoint, the unscaled video is of higher quality, but from a practical standpoint, the scaled video generally forces the video software to begin with a smaller display size, masking some artifacts.

MPEG-1 Video

MPEG-1 Video combined with MPEG-1 Layer II audio in an MPEG-1 Systems container is patent free to my understanding making it one of the only, and certainly the most widespread, patent free formats. Ogg Theora, a somewhat obscure format, is covered by patents owned by VP3 maker On2, but these have been licensed to the public royalty-free.

MPEG-1 Video supported framerates (possibly more?)

In frames per second: 60, 30, 29.97 (half NTSC field rate), 25 (half PAL field rate), 24, 23.976

MPEG-1 Resolution

MPEG-1 supports arbitrary resolutions up to 4095x4095 (Marshall, MPEG Compression). According to the MIT Computer Graphics Group, MPEG-1 Video performs best at resolutions at or below 352x240. Thus at a given bitrate and in defiance of logic, a 720x480 source will look superior when first scaled to 352x240 and encoded to MPEG-1 than when simply encoded at 720x480. However, this depends highly on the particular software used. In my own single test, I have found this to be true for one particular 720x480 source only when encoded at bitrates below 400 kbps using FFmpeg's libavcodec (v 51.28.0).

Various standards use MPEG-1 and specify specific resolutions and bitrates. Video CD for example requires a resolution of 352x240 (NTSC) or 352x288 (PAL). Notably, VCD, like most non-computer video, uses non-square pixels. An NTSC television will display the video in a 4:3 (20:15) aspect ratio, but a computer using square pixels would display the 352x240 image in a 22:15 ratio; the computer's image appears stretched in the horizontal direction. When preparing a VCD, in order to achieve the proper streching, a 4:3 square pixel image should be streched to a 22:15 ratio, e.g. a 320x240 square pixel image should be streched to 352x240.

Tags :



Add a comment Send a TrackBack