The compressed RAW rabbit hole
I was looking at the current fight between evil RED camera company, and Nikon over the unpatentable internal RAW encoding, and then I found an excellent video explaining how RED ripped CineForm RAW encoding to create their R3D or REDCODE RAW codec, a video that I recommend watching: https://youtu.be/IJ_uo-x7Dc0
After watching that video, I finally understand how some RAW video codecs get smaller file sizes, mainly because a RAW bayer pattern image has less data per pixel than a full RGB demosaiced image, the interpolation of pixels of a 12 bits RGGB 2×2 pixel bayer pattern uses only 48bits in total, but after debayering/demosacing each of the original mono-color pixels became full RGB pixels, needing 12 bits per channel/color, thus requiring 144bits of storage for the 2×2 pixel pattern, that is why RAW bayer patterns use less storage, also, using algorithms to guesstimate the values of green-neighbor pixels can significantly reduce the data rate, algorithms like CineForm wavelet and the Green Average Subtraction (GAS).
By the way, I was looking at the fight between evil RED and Nikon because of the claims that the Z9 can record 8K RAW video at up to 60fps, using TicoRAW technology, an article online also claims that “Tico” (which stands for Tiny Codec) has “a patented compression technology that is mathematically lossless and visually lossless down to 1 bit per pixel”, so I downloaded some sample footage to check this claims.
After that, I wanted to create an article comparing the different compression ratios of the most popular RAW codecs out there, by analyzing downloaded footage of each manufacturer and calculating the difference in size of a true RAW video vs. the size of the downloaded footage, but then I hit my first obstacle; I don’t know how to calculate the number of pixels of the original bayer pattern of any device, and this is key to get the numbers right.
If you look for the specs of any camera online that uses a CMOS censor, you’ll see that there are “actual” megapixels and “effective” megapixels, in the case of the Canon 5D Mark IV it has a resolution of 31.7 “actual” megapixels and 30.4 “effective” megapixels, the last one being 6720x4480px which is the demosaiced image you can get in Lightroom for instance; but using RawDigger to see the RAW bayer image you’ll see is a 6744x4502px image. The same as the EOS R5, 47.1 “actual” megapixel and 45 “effective” megapixels 8192x5464px which is what you get in Lightroom, but the Digital Camera Database states that it has a sensor resolution of 8216x5477px… Is it because the IBIS? It is an extra-margin for the demosacing algorithm? Is it because of special processing requirements? Who knows, because there are different explanations online and there is not a consensus.
So, I decided to base my calculation of the uncompressed RAW image on the same number of pixels of the demosaiced footage, I know it is not 100% perfect, but it is a rabbit hole trying to know the right number, and after downloading two sample NAV files of the Nikon Z9 (file 1, file 2) I compared its size and compression with other samples, using the latest version of old mediainfo app on the terminal, so without further due, here are my findings:
Camera | Codec | Ratio |
---|---|---|
Z9 | NRAW | 4.8:1 |
Atomos Ninja | ProRes RAW | 4.1:1 |
EOS R5 | RAW | 3.92:1 |
EOS R5 | RAW Light | 7.55:1 |
Blackmagic Pocket Cinema 6K | BRAW | 6.58:1 |
Here is my Excel document with my calculations: RAW Compression.xlsx
And after seeing the legal battle between evil RED and Nikon, I wonder… How is it that Canon isn’t sued by RED for having internal RAW video recording on many cameras?