Convert a QuickTime’s Color Space¶
Problem¶
You have a QuickTime movie that is not in the desired color space. For example, the QuickTime file has linear color but you want sRGB instead.
Solution¶
Use the Draft.LUT
class:
import Draft
inFile = '/path/to/input.mov'
outFile = '/path/to/output.mov'
dec = Draft.VideoDecoder( inFile )
enc = Draft.VideoEncoder( outFile, dec.fps, dec.width, dec.height )
lut = Draft.LUT.CreateSRGB()
img = Draft.Image.CreateImage( 1, 1 )
while dec.DecodeNextFrame( img ):
lut.Apply( img )
enc.EncodeNextFrame( img )
enc.FinalizeEncoding()
Discussion¶
In our script above, two lines are repsonsible for performing the color conversion. First, we call Draft.LUT.CreateSRGB()
to create the LUT. The returned LUT will convert images from Linear color to sRGB.
Next, we call Apply()
to apply our LUT to every frame in the movie before we encode it into our output movie.
Draft includes several LUTs in addition to sRGB:
LUT | Draft command |
---|---|
Cineon | Draft.LUT.CreateCineon() |
Alexa V3 Log C | Draft.LUT.CreateAlexaV3LogC() |
sRGB | Draft.LUT.CreateSRGB() |
Rec. 709 | Draft.LUT.CreateRec709() |
Gamma correction | Draft.LUT.CreateGamma() |
See Also¶
For the inverting a LUT please review Bake a Color Transform.