Following up on last month’s blog post, we’d like to continue our discussion on the technical specifications we look at during the editing and compressing phases of surgical video production, with a focus on image compression.
Here again, are the specifications we recommend for final video output, intended for posting online, which are directly concerned with video compression:
Container: MPEG4 (mp4)
Bitrate: 5 Mbps
When we zoom in closely on an image or video, we can see individual pixels, each of which has an X value, representing width position, Y value representing height position, R the amount of red, G the amount of green, and B the amount of blue.
When we look at a digital image, we are essentially looking at a grid of coloured squares, pixels, each of which are stored in the image file by coding the X and Y coordinates of where the pixel is located, as well as its colour information. The color of each pixels is expressed with a set of numbers that designate the amount of Red, Green, and Blue, or, "RGB" value.
Seems simple enough, but as images get larger, and especially when we are dealing with video, which is a continuous series of still images, we end up with longer and longer strings of code that describe how to display each individual pixel. In order to reduce the total size of the image or video, the information about each pixel’s position and color value need to be simplified, or compressed.
Image compression, in the simplest of terms, basically means looking at large patches of pixels in an image, and for each “XYRGB” set of numbers, instead of writing 1,1,0,0,0; 1,2,0,0,0; 1,3,0,0,0; 1,4,0,0,0; 1,5,0,0,0 the file will instead summarize this with code that is the equivalent of writing 0,0,0x5.
It’s actually a lot more elegant than this, in fact, image compression gets right down to the binary code of the image file, and will shorten an entire page worth of 1s and 0s into the length of just a few sentences worth. Pretty impressive. Just remember, each character in the code of a file takes up space, so wherever you write that code in a “shorthand” version, you can reduce the file size considerably.
The areas of this image overlaid with green contain pixels that are likely to change over each frame, whereas the areas outside the green contain pixels that will likely not change, and so during video compression, the pixels outside the green will not require the code that represents them to be continuously updated. Video compression algorithms reduce file size by writing new code only for the pixels that change over time.
Now what’s interesting is that this process of simplifying the code of an image or video can be done in various different ways, and these different approaches in turn result in the various file formats we have today. JPG for example, is one such compression algorithm that works exceptionally well, and as a result is probably the most common file format for images you’ll find on the web.
For video, the compression algorithms or “formulas” that prescribe how the compression will happen are called codecs. Similar to JPG for still images, the H.264 video codec is an elegant and efficient codec that produces high-quality video at the smallest possible file size. H.264 is used to encode video into various file formats, most commonly mp4.
There are roughly 3 file formats, or “containers” that are the most popular for video: MOV which is used mainly on Mac, AVI which is used mainly on PC, and MP4, which can be used for either.
It’s important to note that many video editing programs have different methods for outputting compressed vs. uncompressed video. In Apple’s iMovie for example, choosing Share > Export Movie will create an uncompressed video file...
...whereas choosing Share > Export using QuickTime will give you access to different settings that produce a compressed video file. Sometimes you can get a better end result by exporting an uncompressed video from your video editing software, and then compressing that exported video file with software specialized for compression.
Thanks for tuning in, check back with us for next month's conclusion to this video editing tips series, where we'll discuss video bitrate settings for posting videos online.