Wednesday, January 16, 2013

DCI Converter

When I released a JPEG 2000 plug-in for Premiere that had an option to perform XYZ color space conversions for DCI, I managed to open a little can of worms.

My goal was to match the conversion done in After Effects when using the "DCDM X'Y'Z'(Gamma 2.6) 5900K (by Adobe)" profile, but other programs seem to perform this conversion differently. Rather than debate whether I was doing it right or wrong, I decided the best thing to do was make my code visible and open for commentary and include a document describing the steps I was taking. You can see it here on GitHub.

Because a snippet of color conversion code isn't very interesting by itself, the repository also includes a plug-in for After Effects and Premiere Pro (CS5 and above) that you can download below. It can also convert from XYZ back to RGB, so that will let you view your DCI files properly in Premiere. (If you use this plug-in to convert to XYZ in Premiere, make sure you turn off the XYZ conversion in j2k.)

Update: It has been called to my attention that a step was missing from my conversion process: XYZ normalization. Hooray for open source! You can learn about it in the ReadMe, but a new parameter has been added and I'm leaving it on by default. This means DCI Converter's default settings no longer exactly match Adobe's. I've also spread the change to j2k in Premiere.

Update: Been talking with Adobe, and it's becoming more clear that using the Rec. 709 response curve is not the right choice for most people. According to BT.1886, a professional HDTV broadcast monitor has a simple gamma 2.4. So if you approve the final look of your video on such a monitor, that's the transfer function you should be using. If you approved it on an sRGB computer monitor, than use that curve. For now I'm not going to change the plug-in's defaults, which would introduce some technical issues in AE. We'll still adhere to the original design goal of matching Adobe's profile even as we cast doubt upon it, but I suggest you at least try using gamma 2.4.

Version: 0.8
Date: 27 April 2022
Mac | Win


atomick said...

Dear Brandon,

thank you very much for this most useful plugin. Is there a discussion somewhere about your code?

Best, Michael

Brendan said...

No public discussion yet. Care to start one? We can just use these comments as the message board.

Make sure you read my color science explanation on GitHub or in the ReadMe.


Unknown said...

thank you for this awesome plugin.
Which settings work most effectively in premier?

Brendan said...

The default settings (pictured above) match using the AE Color Profile Converter with these settings:

input: HDTV (Rec. 709)
output: DCDM X'Y'Z'(Gamma 2.6) 5900K (by Adobe)
Scene-ref. Profile Compensation: Off

I know one user who is switching the response curve to Gamma 2.2 because it more closely matches what comes out of EasyDCP and DCP Pro.

Tough to know which settings are actually the best. The real test would be to try different settings and then see which looks best with a projector.

If there is a superior method out there and someone wants to tell me the algorithm, I'll happily incorporate it into the plug-in.

Danko said...

Hi Brendan,

as usual - what would we do without you? Can't think of...


Goodcore said...

Thanks for sharing another good one :)

Anonymous said...

Great! Thanks! Just a moment ago got this task: to convert DCP back to video, and here it is :)

One question: Premiere and After Effects don't import MXFs. Is it possible to write import plugin for it to skip extracting J2Ks from MXF?

Brendan said...

It would be possible to make an MXF importer plug-in, but I have no plans to do so in the immediate future.

atomick said...

Hi Brendan,

I have investigated on the "lossless" feature of j2k.

- Premiere calculates internally with 32bit if the sequence is set to max quality in the sequence options.
- some internal plugins (ycc, 32bit) are used for grading.
- so there could be a transformation out of the 8 bit color space applying these transformations via plugins.
- j2k shows therefore differences between rendered images in 8,12 and 16 bit.

i suggest, it will be best to use 12 or 16 bit then as "lossless" working internally in 32bit in premiere.

I have made some images showing this differences. as i cannot upload them right here, i probably will have to make a page and paste the link in here.

are my assumptions right?

best, michael

Brendan said...

True, "lossless" means lossless at the chosen bit depth. J2K defaults to 8-bit, and you can set a higher bit depth by checking the advanced checkbox.

When in saving 8-bit, j2k asks Premiere for an 8-bit buffer. Anything higher and it asks for 16-bit. One would hope that an 8-bit buffer would look the same as a reduced 16-bit buffer, but maybe not?

There's no way for me to know if the max quality checkbox is on, and I'm not sure I'd want to behave differently if I did.

Perhaps I should just move the bit depth parameter out of the advanced section and make you set it every time. It makes more sense to have it buried for Photoshop and After Effects where the project has a real bit depth setting and j2k matches that by default.

You can email me samples if you want me to take a look.

atomick said...

i made a blog entry about lossless differences of your plugin:

Unknown said...

Can't thank you enough for this and your JPEG2000 export plug-in.

After experimenting with both of those and the EasyDCP player, it looks like the best method for me is the "Gamma" colorspace conversion method with the filter plug-in, then exporting with the export plug-in (no further conversion).

Any chance this method can be added to the export plug-in? I think it would be much faster...

Thanks again for all your efforts!!

Brendan said...

When you switch to the Gamma response curve, I assume that also means you leave the Gamma parameter at its default value of 2.2. People tell me that setting is close to what EasyDCP does. If the EasyDCP developers told me exactly what they were doing, then perhaps I could match it exactly.

The real test is to see which method best matches what comes out of your projector. So if you have a Rec709 source, how does the preview on an HDTV compare to the projector in a theater? EasyDCP seems to think that a 2.2 gamma gives you the best conversion, but in theory it should be the Rec709 response curve.

I don't think I'll be adding more conversion controls to the j2k plug-in. I am already uncomfortable with doing any color conversion at all on the export end (you can't preview the results of your changes), but it seemed necessary for novice users who chose the Digital Cinema option. Experienced users should turn off conversion on the export end and just use the DCI Converter plug-in in the timeline. The easiest thing to do is drop your edited sequence into a new sequence and apply the plug-in, or you could alternatively do it with an adjustment layer in CS6.

Unknown said...

Well, that's Fraunhofer we're talking about, so good luck getting any info out of those guys. ;)

But anyway, they checked said DCP at Dolby Labs NYC today, and said it looked reference quality, so everyone is happy. Just upgraded my video card, so hopefully the CUDA support will make at least part of the export go faster next round.

Thanks again!

Anonymous said...

I placed the j2k Premiere.bundle "plugin" into the appropriate folder

/Library/Application Support/Adobe/Common/Plug-ins/CS6/MediaCore

and it does not show up ANYWHERE in the Premiere Pro CS6 program. I'm in desperate need of this plugin for a deadline. Am I missing something with where the .bundle file is being placed?

Brendan said...

(should maybe have posted that on a j2k blog entry....)

You have it in the right place, it seems. Go to File > Export > Media and set the format to JPEG 2000.

If it's not showing up....?

Anonymous said...

Great!! It's showing up now. Not sure why it suddenly started to appear, but I will take it. Thanks for the quick response. Thanks!

Anonymous said...

Sorry one more thing... my apologies if this isn't on the right spot. In the export dialog, the "DCI XYZ Conversion" is this field to set the input color space for the conversion to happen upon export? Looking for confirmation as to what that field is. Thanks.

Brendan said...

(Probably should post on a j2k entry, but you're getting warmer...)

Yes, you're specifying the input color space, and then the output space will be XYZ.

If you want more fine control, you can set the conversion to None and then use the DCI Converter plug-in to convert to XYZ in the timeline.

Danko said...


some more feedback after testing...

DCI Converter is absolutely great - I can convert between RGB & XYZ and can tweak all needed parameters to get the desired results... but...

I have a big problem with speed - DCI converter only uses one CPU core and so conversion takes very long...

because of that I only use the plugin to take a quick look on J2C sequences in a Premiere timeline.

then all conversions are done with easyDCP Creator because it is much faster in color transform and J2C encoding...

If DCI converter and j2k plugin would be using all CPU cores it could be easily used in everyday live...

What about a commercial version like the open EXR Plugin? Would love it ;-)

Brendan said...

The DCI converter plug-in should use all the CPUs. It uses the multi-threading functions provided by After Effects and Premiere.

Which version are you using? Which platform?

Danko said...

Hi Brandon,

"...It uses the multi-threading functions provided by After Effects and Premiere..."

that gives me hope ;-)

but what makes me crazy is that I don't get it to use all my CPU cores and the render times get longer and longer... If I would know a second CPU with more cores would help - I could do something to speed things up...

--> I've started a detailed test session with different use scenarios an will send you the results by mail.

Hopefully that will help to understand the issue and we can post back some tips here...

All the Best

Tim said...

This is great!

Unknown said...

Am I crazy and doing something wrong or are the blacks lifted when using DCI converter with the settings response curve REC709, Color space sRGB/REC709, Color Temp 5900, XYZ Gamma 2.6?

I convert back using the Adobe DCDM X'Y'Z' profile and the REC709 profile.

Tormaid said...

I have a question about your AE/Premiere J2K encoder. In lossless mode at 1920x1080 in RGB at 16-bits per sample the images I'm getting are ~1.7mb a piece. Imagemagick's encoder is spiting out files 3-4x that size from the same source. What's going on?

Brendan said...

I don't know! I guess the thing to do would be compare the results, maybe using Photoshop. Stack two frames on top of each other and toggle between them or use the difference transfer mode.

Anonymous said...

Hi Brendan, First thank you for this great plugin. I'm using it with Premiere CC latest version, on Mac and it keeps crashing during 1998x1080 24P Prores exports ("unknown error compiling movie"). It works fine with Premiere 5.5 on Mac. Any possibility to upgrade this version to CC ? Thanks !

Best, Julie

Stefan said...

First of all, thank you very much Brendan! It's magnificent!

I got my material out from Resolve as DPX... tried lots of different conversion methods (sRGB, Rec709, through both your plugins and OpenDCP), but there's always a big gamma difference from source material - the result is always blacks that are not blacks but grays.

The option that matches almost exactly my source material is by selecting the gamma response curve to a value of 2.2... and D65... I would be thankful if someone with more knowledge about color space and those things could comment a little bit because I'm kind of new to this...

Brendan said...

I'm disappointed, but not surprised, that even something as advanced as Resolve uses gamma 2.2 for their conversion as opposed to the actual Rec 709 curve.

The real question is: how does your image converted to XYZ space look when projected? If you make one version with gamma 2.2 and one with Rec 709, which looks more like your source?

Note that this plug-in does not account for any 16-235 type issues and expects pixels to span the full range of 0-255 (0-1023 in 10-bit). Most codecs hand off 0-255 images, but you might want to check that histogram to make sure. If not, you can use Levels before the DCI converter to fix it.

Stefan said...

After testing in a cinema (Dolby server and NEC projector, can't remember which ones exactly) I can only confirm what I told in the previous post - the gamma curve 2.2 is much closer the the DPX source... contrast is as it should be, with rec709 or srgb all blacks are grey and I got the feeling that the image is a little bit warmer than original...

Brendan said...

Well, if gamma 2.2 creates the best match between the Rec. 709 source (as displayed on a calibrated Rec. 709 broadcast monitor) and the projected output, then I guess that's the setting to use!

I'm surprised because as far as I understand the theory, that should not be the case. But whatever actually works in practice is what you should use, of course.

The trap to avoid is comparing the original footage on a computer with the DCI preview provided by a program like EasyDCP on that same computer. Because then you are not comparing the settings with real results, but with whatever algorithm is used by EasyDCP. Sounds like you avoided that trap though.

The reason I made this code open source is so that other people who think it should be done differently can have input. I'd love to hear from a DaVinci person why Rec. 709 footage should be linearized using a simple 2.2 gamma curve or about any other step in the conversion process.

Wolfram said...

Dear Brandon,

I have downloaded the DCI CONVERTER and have copied the exgracted file to the plugin folder within Adobe Premiere Pro CS6. When I am now using the export function I can't find DCI CONVERTER in the menu. Where should it appear?

Thanks, Wolfram

Dob said...

thx for your great plugins (I am also a proud customer of the ProEXR one)!
I have a question about j2k. I am using it to create JPEG2000 sequence out of AE CS6. You mention in the j2k manual that "This specification calls for 12-bit JPEG 2000 frames encoded in XYZ color space".
But the resulting files are 8-bit when opened in Photoshop?

Brendan said...

DCI Converter will appear under Utility. You can also just search in the Effects & Presets palette.

Brendan said...

Hey Dob, I bet that the file opened in Photoshop using Photoshop's built-in importer, which I've found has issues. If you install the j2k plug-in for Photoshop, it should open anything greater than 8-bit in 16-bit mode.

Dob said...

Yep, you were 100% right. Installed the Photoshop plugin, now j2c shows up as 16-bit. Thanks!

Unknown said...

wow Brendan thank you i can see fnord lights
works on yosemite
however the date and the version was confusing as the file appears as version 0.5 from what appears as 2012 on other websites. maybe it's worthwhile to metion near the download that it is updated / compatible with Lr 5 and yosemite.
anyhow great :)

gbalaji said...

Do you have LUT for XYZ to RGB for Davinci Resolve

Brendan said...

This plug-in doesn't make LUTs, but you could use it with LUT Buddy to generate one for Resolve, I believe.

Unknown said...

Download links are not alive.Thx

Fred ZARF said...
This comment has been removed by the author.
Fred ZARF said...
This comment has been removed by the author.
Fred ZARF said...

From an untouched "Rec.709" footage and without color management in After Effects, I saw that the DCI Converter with these parameters :
Operation : RGB to XYZ
Response curve : sRGB
RGB color space : sRGB/Rec.709
Chromatic Adaptation : Color Temperature
Color Temperature (K) : 5900
Normalize : off
XYZ Gamma : 2.60
... offers the same result (perfect match !) than a color conversion to "DCDM X'Y'Z' (gamma 2.6) 5900K (by Adobe)" from the same "Rec.709" footage, correctly interpreted, with color management on (Scene-ref. Profile Compensation : on, very important !)...

Why choosing "Response curve : sRGB" ??? It could mean that, without color management, After Effects considers that the response curve of a "Rec.709" footage is "sRGB"... and not "Rec.709"... which is not exactly the same.


I tried this, I have imported a "Rec.709" footage in After Effects without color management and I have imported it in a comp... and then, I have activated the color management (the "Rec.709" footage has been correctly interpreted as "Rec.709")... and I could see a little shift in very dark tones... and it's exactly like the footage moved from the "sRGB" to the "Rec.709" response curve.

So, to use the DCI Converter without color management in After Effects, it means that, with a "Rec.709" footage, to properly convert the colors, you have to choose "sRGB" as response curve (and not "Rec.709"). Even if the color profile "Rec.709" is embedded in the footage.

I made hundreds of DCPs for commercials, documentaries, shorts, music video clips... etc... and I've always used the color conversion with color management on... and it worked perfectly each time (juste not forget to have Scene-ref. Profile Compensation : on, if you forget that, you can obtain washed-out DCPs... gamma is not set to 2.6 at the end, it's awful on screen). The DCI converter does something more with the normalization (to prevent from white clipping and to keep a virtual white point at 5900K or D60 that differs from the ugly greenish white point on DCI projectors)... it's why I'm looking at it.

Brendan said...

Experiment with the Scene Referred Profile Compensation setting in Adobe's ICC color profile stuff. It has to be off to use the Rec. 709 response curve. Having it on will use sRGB in place of Rec. 709.

Rec. 709 is scene-referred. It describes how light entering the camera from the scene gets encoded. But then this video is not intended to be displayed with the inverse curve but rather sRGB or maybe gamma 2.4 according to BT.1886. The reason for this is that an image in a dark theater needs an increase in contrast to look right.

So the Scene Referred compensation setting lets you flag the footage as Rec. 709 but then still display it using sRGB, which gives the contrast boost.

This plug-in is just a tool that provides access to settings. It's up to you to experiment and figure out what works best for you. Your goal is to be able to make creative decisions on a monitor of your choosing and then have the DCP look the same when projected.

Jack Hands said...

I am attempting to make a DCP from an (almost) Rec 709 pro res file.

We graded in a projector enviroment at 2.6 gamma but with Rec709 colour values (rather than at P3).

Does anyone know the best settings for converting it for DCP? I am thinking setting the incoming curve to 2.6 Gamma.

Brendan said...

If you mean the projector was hooked up to your computer during grading, then it sounds like you'd want to use Gamma 2.6 as your response curve. As I say in the post, the important thing is not where the video came from, but the device on which the look was approved. I'd say you should also try turning Chromatic Adaptation off. Experiment!

Unknown said...

I'm a french free director and I just finished the editing of my first feature... and I need a DCP for screening in theater... So I read many informations about sRVB -> DCI conversion and I have downloaded your plug-in en tested it on a short sequence ... so the image looks bad ;-) compared with the original one...
So here is my question :
is the image that produce your plug-in the one I need for a DCP ? in other word, my movie need to be encoded with that bad look to be right on a Digital Theater ?

sorry for my english
best regards

Unknown said...

Brendan, first, thanks so much for your time and efforts in creating the plug-in and DCI converter. Much appreciated by many people.

I'm glad to read your 'update' at the top related to Rec 1886, as I have my monitor calibrated to 1886. However, later on you said that it was a simple 2.4 gamma, but not sure that is correct. My understanding is that BT 1886 specifies a gamma that is somewhat sectioned into two pieces, one that is closer to a gamma of 2.2 at the very low (shadows) end, which provides for greater separation of blacks, which then transitions to another section that is closer to gamma 2.4. for the remainder (majority) of the curve. I don't know if you use a simple 2.4 gamma in your equations or if you use the actual BT 1886 equation. Rec 709 actually doesn't specify a Gamma, which is, I understand, why 1886 was created. What I would like to understand as I create my DCP, is which setting will best reflect my monitor BT 1886 calibration (btw, I chose 1886 because I am monitoring at 80 nits in a dim room - which may be equivalent to viewing gamma 2.2 in a normally lit room at 100 nits - I don't know). It seems that neither Rec 709 or a gamma setting of 2.4 will be exactly correct. Do you have any insight into this and/or 1886?

Thanks again,

Plagiarism Software said...

Device transformation is the procedure of transforming both the conventional components in 1 sort into the following based to this demand. The demand for its simple transformation has ever existed from the various areas for distinct functions. Many internet instruments and Unit Converter can be found and these are able to be depended on for practically any conversions now. Using all these tools that the intricate emotional calculation might be averted and accurate and quick results might be found.

reginald surict said...

Get to know this admission essay writing service. It's one of the best I've ever dealt with.