Overview of the REDCODE File FormatOctober 03, 2012
REDCODE is a key advance that made the first 4K video captures a reality. It has since been used for a growing array of movies, and is fully supported by all major post-production software. In this article, we’d like to share more about the inner-workings of this much-discussed format.
REDCODE RAW (.R3D) is a proprietary file format that efficiently encodes measurements from a camera’s digital sensor in a way that maximizes post-production capabilities. It achieves this in part by storing each of the sensor’s color channels separately, prior to conversion into a full color image. Similar to the advantages that RAW files brought to stills photography, this improves control over white balance, exposure and grading in post-production. Furthermore, since such settings are appended to the file as metadata only, grading is completely non-destructive.
Compression is often thought of in terms of achieving smaller file sizes, but just as importantly, compression can also enable higher image quality within the constraints of one’s recording medium. This was the primary motivation behind the original development of REDCODE.
REDCODE achieves this by using an efficient, variable bitrate “wavelet” technique. This is an extension of how JPEG2000* is able to achieve higher quality stills than other formats at the same file size:
*Although JPEG2000 is a helpful analogy, RED’s approach has been custom-designed for the needs of high data rate motion capture, and thus cannot be compared directly. Specific implementations of JPEG2000 also vary.
This efficiency is achieved in part because wavelet compression encodes image features at different scales separately. A wavelet file therefore contains a low-resolution base image, plus progressively higher resolution components — all the way up to the final full-resolution image, which is the net combination of all these:
As a result, low-resolution previews can be generated without having to process the entire high-resolution file. For example, a quarter resolution preview could be generated from just the above base image plus the leftmost component. Wavelets therefore make it easier to directly view and edit large videos on desktop computers.
Wavelet compression is also better suited to motion capture since it preserves smoother frame-to-frame tonality — primarily because it avoids the distracting “macro blocking” effects of other common approaches:
Note how macro blocking effectively creates large-scale pixels — especially within the hair, skin and background. This effect varies depending on compression setting, but is present to some degree with most video codecs in use today.
REDCODE permits a wide range of compression settings to suit your particular storage and usage requirements. Settings are specified as file size ratios compared to an equivalent uncompressed data stream, with higher ratios denoting more compression. These range from 3:1 all the way up to 18:1, with integer precision throughout this range.
Just below 3:1 is mathematically lossless, but settings in the range of 5:1 to 8:1 are typically visually lossless and advisable for most usage scenarios. At the same resolution, these settings also require less storage space than the visually lossy ProRes 422 format. Cinematographers for major motion pictures such as The Amazing Spiderman and The Hobbit have therefore been shooting at settings near 5:1.
Sometimes the choice of compression setting isn’t just one of data rate versus file size, but also includes other considerations such as maximum frame rate and HDRx™ capability. For example, some of the lower compression ratios likely won’t be available at the highest frame rates; refer to the latest operations guide for your particular camera to see the possibilities. Similarly, HDRx™ captures twice the frame rate, and therefore double the data, so increasing the compression ratio can help offset this data rate increase. Ratios of 10:1 and higher might also be helpful for video that will be downsized in post-production, but where usage of the entire sensor area is desired during capture.
When in doubt, try capturing sample footage at a range of compression settings to identify what works best for your intended usage and workflow. Most are quite surprised at what they can achieve for a given data rate.
- Future Proofing. R3D files can be re-converted at a later date to benefit from future improvements in RAW development software, such as with demosaicing algorithms and color science.
- Compatible File Sizes. The R3D format overcomes FAT32 and other partition limitations since it seamlessly auto-segments into 4 GB files.
- Royalty-Free Duration. The R3D format isn’t subject to the royalty fees required by other formats, including H.264 if not an end-user.