Site icon ProVideo Coalition

Using EXRs and DWA in After Effects

Using EXRs and DWA in After Effects 8

Codecs aren’t the most exciting thing to write about, but a recent update to After Effects included a tiny note that caught my interest.  The DWA compression option for EXRs now includes a quality setting.  It doesn’t sound like much, but EXRs with DWA have been my output / codec of choice for several years now, so this new update makes me very happy.  Let’s have a look at why.

See the bit where it says “DWA Compression 45”? That’s new. It’s great.

To .mov or not to .mov

I spend a lot of time contemplating the differences between the world of motion graphics design, and the world of visual FX.  One subtle difference between these fields is the popularity of various codecs and file formats.  If you’re working in the world of visual FX, then the industry standard file format is EXR.  An EXR file is a single image, unlike video files like Quicktime or MP4, and so VFX artists are primarily working with and rendering to image sequences.

Motion Graphics Designers tend to use Quicktime files, with Prores the codec that offers the most flexibility and acceptance.  But it’s only been relatively recently that Windows machines running After Effects could render a genuine Prores file, and until that happened there were all sorts of other options floating around.

When looking at either an image sequence or a single Quicktime file, there are pros and cons for each option.  For a designer working on one machine, then rendering to Quicktime provides a single file that can be immediately played and shared, including embedded audio.  This is easy and convenient.  However there are a number of drawbacks to Quicktime files.  Firstly, rendering to a single file isn’t something that can be sped up by distributing the project across a render farm – only a single machine can render to a single Quicktime file.  Secondly, if you need to make a change to a small section of the timeline, then the entire duration needs to be rendered out again.  This means even the most simple revisions can take just as long to render as the whole thing.

Rendering to image sequences also has advantages and disadvantages.  One of the biggest advantages to sequences is that you can distribute a project across multiple computers, to speed up rendering.  If you want to set up a render farm, you have to start using image sequences.  While 3D render farms are commonplace, it’s just as feasible to set up an After Effects render farm too.  Not only does After Effects have rudimentary render farm support built in (watch folders), but Adobe explicitly allow you to install as many render-only versions of After Effects as you want without having to purchase additional licenses.  The next big advantage of rendering to image sequences is that if you need to make a small change, you only need to render the frames that are affected – not the whole thing.  This can be an absolute lifesaver in the world of tight deadlines.

But there are disadvantages too.  Unlike Quicktime files, an image sequence can’t contain embedded audio.  If you’re working with audio, then once you’ve rendered out an image sequence, there’s an additional step of importing it into something that can add audio, and then rendering out again to a Quicktime or MP4 file that you can preview and share.   Even if you’re not working with audio, playing back an image sequence will require you to use an app that can do just that.  Outside of After Effects, Premiere and Adobe Media Encoder, there are a number of popular choices such as DJV, but that’s not something that your average Art Director will have installed on their machine.

But while there’s always room for personal choice, I’ve always thought that the advantages of working with image sequences outweighed the disadvantages, and so for over 12 years now it’s been my preference to render everything to image sequences, and then convert them to Quicktimes / MP4s when necessary.

The big Qs: Quality and Quantity

But while it’s one decision to choose between a Quicktime file or an image sequence, you still need to choose a codec – the algorithm that encodes the images into a file.  This is a much more complicated topic, because it encompasses the somewhat touchy subject of quality, across a technical landscape that has evolved considerably over the past 30 years.

The term “Codec” is short for “compression / decompression”, and the reason the term exists is because without some form of compression, video file sizes can quickly become astronomical.  In my series on After Effects & Performance, I dedicated an entire article to the topic of file sizes, resolution and bit depth.  While the full article has all the details, the simple version is that video files can get very big, very quickly.  The solution is to use compression to make the file sizes smaller, but this is where it starts to get murky.  Many types of compression involve some type of quality loss, but the exact correlation between codecs and quality is often misunderstood.

JPEGs let you choose how you balance file size with image quality. But note that at maximum quality, there’s no quality loss due to JPEG compression, just some tiny rounding errors.

JPEG, which originated way back in the 1980s, is still a very popular and useful format.  One distinguishing feature of the JPEG format is that the user can control the balance of file size versus quality.  A very high compression ratio means a lot of detail loss, while a low compression ratio can produce a much smaller file size without any perceptible loss in quality to the viewer.

When I first started working in the late 1990s, various editing systems and digital tape formats made a range of claims about their compression quality.  I was worried that I didn’t understand some of the technical jargon that was proudly advertised (what exactly is 4:2:2?), and I began looking into exactly how the different image compression algorithms worked.  I even received some information directly from an Apple employee who’d worked on parts of Quicktime, and he confirmed that a JPEG at full quality is almost lossless.  There are a few rounding errors that pop up, but the image itself is not altered by the compression algorithm.  Even today, I come across many people who assume that JPEG compression is automatically a bad thing, and it’s not uncommon to find people who refuse to use JPEGs because of their perceived lack of “quality”.  However it’s worth knowing that if you set the quality to maximum, then the quality loss is so small it’s almost a mathematical novelty.  For many years, JPEGs at 100% quality suited my needs fine – and that’s how I worked by default.

For some people though, the thought of any sort of “loss” is unacceptable, and so there are other codecs which can still compress an image to a smaller file size, without any change to the image at all.  These are often referred to as “lossless” codecs.

When desktop video was emerging throughout the 1990s, these were fairly hot topics.  The “quality” of various codecs, as well as the distinction between lossless and lossy compression, was one of the more tedious things which needed to be understood.  I could write an entire article about the difference between “lossless” and “uncompressed” – but many other people already have.  It seemed more important around 20 years ago.  But as desktop graphics evolved, it only got more complicated- and something that was true in 1999 was no longer accurate in 2009.

After Effects has always come with a range of default output modules, including a “lossless” option. But “lossless” is only lossless in 8-bit mode.

Take the term “lossless”, for example.  Until very recently, After Effects shipped with a number of default output modules – including one called “lossless”.  Lossless was a setting that used the “animation” codec, an algorithm that could reduce the file size of an image without changing a single pixel.  For the technically minded, the animation codec used RLE (run length encoding).  This set it apart from a codec like JPEG, which could create a smaller file size but also reduce the image quality.  So the distinction seemed pretty clear – “lossless” meant mathematically lossless, a file that was identical to the original.

And in 1999 it was.

But the problem is that the animation codec, and the “lossless” setting, only works in 8 bit.  And it wasn’t long before After Effects began to offer 16 and then 32 bit projects.  If a user had created a project in 16 bit mode, and then rendered it out using the “lossless” setting, then it wasn’t actually lossless at all.  The 16 bit fidelity was being lost as the image was converted to 8 bits.

Conversely, visually lossless codecs such as Prores were released, and while they weren’t mathematically lossless they did support higher bit depths.  So this has resulted in a situation where a user working in a 16-bit project could render to the “lossless” setting and yet lose quality, but they could render to a “lossy” codec such as Prores and yet retain more detail.

HDR projects – working with 32 bits in floating point – presented a greater challenge, as relatively few formats support 32 bit images.  Rendering a 32 bit HDR project with the “lossless” preset is definitely not “lossless”.

Enter EXR

Over 20 years ago, VFX giant Industrial Light & Magic recognized the need for a industry standard file format that supported floating point (HDR) images, but with the flexibility for a range of different applications.  They came up with the Open EXR file format, which proved hugely successful and remains the industry standard for Hollywood VFX companies to this day.

After Effects used to have problems with EXR files – but they’ve been fixed. This older article details what the problems were, as well as some of the benefits of using EXRs. Improving the performance of EXR files was something that Adobe prioritized for the CC 2020 release.

Before we go any further, it’s worth noting that for a long time, After Effects did not have a good reputation for dealing with EXRs.  However this is no longer the case.  As I detail in an older article of mine, a few years ago Adobe focused their attention on the performance of EXRs and the result has been an incredible improvement.  Since the release of After Effects 2020, some heavy multi-layered EXR files are now read up to 20x faster than in previous releases.

Within After Effects, EXRs have gone from a format that was plagued with poor performance to one of the best options.

Feature List

EXRs come with a range of compression options, including lossless and lossy choices.

When compared to an older format like JPEG, EXRs have a range of additional features and benefits – many of which I demonstrate in my older article.  It’s worth noting that EXRs can include an alpha channel (JPEGs can’t), and like Quicktime files the user has a choice of several codecs that use different mathematical algorithms to reduce file size.

For users who need complete, mathematically lossless images, the EXR format supports RLE and ZIP compression – the same type of compression used to create ZIP files on your desktop.  However these files can still be very large.

Among the other compression options is an algorithm called DWA, which is comparable to JPEG while offering all of the benefits of the EXR format.  DWA was developed by Dreamworks Animation, so it’s got a pretty decent pedigree.  Like the older JPEG algorithm, DWA allows the user to balance quality and file size as they need to.  The quality setting for the DWA algorithm represents a compression ratio – the smaller the number, the less compression and the larger file size.  A higher setting results in lower quality.

The DWA algorithm itself has two variations, simply named A & B, and they differ in how many lines of the image are processed together.  The actual compression algorithm is the same, but depending on the resolution of the overall image and the type of details in the image itself, they can produce different files sizes.  In my limited tests, DWAB produces smaller files than DWAA when used with large resolution images from live-action sources.  However it’s possible that DWAA could produce a smaller file size with lower-resolution images, or different types of images.  It’s not something I have looked into extensively.  Compared to the massive file size differences between DWA and ZIP, the difference between DWAA and DWAB is relatively tiny.

For as long as After Effects has supported EXR files, the default compression setting for DWA has been set to “45”, with no option for the user to change this.  But with the latest release of After Effects, the DWA option now presents the user with a quality setting – giving full control over file size and quality.

The default setting has always been 45, but now you can change it. A lower value will give you a higher quality image and a larger file size. A larger value will give you smaller files and lower quality.

Ticking all my boxes

So why does this make me happy?

For many years my default output option was JPEG sequences at maximum quality.  For the type of work I was doing, this was fine – and to repeat myseful from above, a JPEG at full quality is almost, nearly lossless.  The quality difference between a JPEG at the highest setting and a lossless format isn’t worth worrying about.  But JPEGs only work in 8 bit colour, and they don’t support an alpha channel.  The lack of an alpha channel was especially annoying, because any time I wanted to pre-render something with transparency, I’d have to use a TIFF sequence instead.

As I started doing more and more work in 32 bit mode, JPEGs no longer cut it.  I needed to begin using a file format that supported 32 bit images, with alpha channels.  And that’s what EXR sequence were specifically designed for.

So for some years now EXR sequences have been my format of choice, and after discovering how quickly my hard drive fills up with ZIP compression, I switched to DWAB.  This combination gives me everything I’m looking for:

This article demonstrates how to convert R3D clips to EXR sequences, while retaining all their HDR and wide-colour-gamut information. Using ZIP as your compression will quickly fill your hard drive – DWA is a much better choice.

It wasn’t that long ago that I was working on a project that used 8K footage shot on a RED camera.  As detailed in an earlier article, the first step when dealing with RED footage is to convert it to an EXR sequence, maintaining the full dynamic range of the original R3D files.  For something that was destined to be delivered at 1920 x 1080, using DWAB compression for the rushes saved me hundreds of gigabytes in drive space (compared to ZIP16), while maintain high quality, HDR images in a 32 bit linear  colourspace.  And the option is always there for an alpha channel too, something not offered by JPEGs or most Prores formats.

In fact I’m not aware of another option for rendering a compressed image with an alpha channel.  If you want a Prores with an alpha channel, you have to use Prores 4444 – this gives you an alpha channel, but it also gives you a large file.  JPEGs don’t support an alpha channel at all, and the compression algorithm for TIFFs is pretty crude.  An EXR sequence using DWA gives me the ability to have a smaller size image AND an alpha channel.

Now that I have more control over the DWA compression algorithm, I can choose how I balance file size and drive space with image quality, all while working in 32 bits with a high dynamic range.  So yeah – it might seem like a little thing, but it’s definitely worth noting.

I’ve been using EXR sequences with DWAB compression for several years now, and it looks like that will continue.

If you’ve found this article interesting then please check out my other After Effects pieces – I’ve been writing them for about 20 years!

Exit mobile version