AWS Thinkbox Discussion Forums

Use Draft without deadline

How can I use draft to convert a sequence of EXR’s to a mov file without having to run it through deadline? Is it possible to just call it directly using python?

Are there some examples I can look at?

In my case I have a list of exr images I want to convert to an h264 video.
Not sure how to do this with python. I’m still looking around in the code.

All i need to set is the framerate and the codec, possibly the resolution as well.

Draft Standalone:
docs.thinkboxsoftware.com/produ … standalone

Draft Python cookbook:
docs.thinkboxsoftware.com/produ … l#cookbook

Update. For anyone looking for examples here are two functions that convert an incoming image sequence to an H264 mov file and the other function converts exrs to pngs.

[code]
import sys
sys.path.insert(0,‘C:\DeadlineRepository8\draft\Windows\32bit’)
import Draft
from DraftParamParser import ReplaceFilenameHashesWithNumber
import os

def renderDraftQT(source, destination, startframe, endframe):
‘’’
convert one image to another using draft.
ex: renderDraftQT(’/exr2/teapot_.####.exr’, ‘/exr2/teapot_h264proxy.mov’, 0, 30)
‘’’
encoder = Draft.VideoEncoder( destination, codec=‘H264’, quality=85, fps=23.976 )

for frame in range (startframe, endframe + 1):
    fileIn = ReplaceFilenameHashesWithNumber( source, frame )
    img = Draft.Image.ReadFromFile( fileIn )
    img.ApplyGamma( 1.0 / 2.2 )
    encoder.EncodeNextFrame( img )

encoder.FinalizeEncoding()

def renderDraftPNG(source, destination, startframe, endframe):
‘’’
convert one image to another using draft.
ex: renderDraftPNG(’/exr2/teapot_.####.exr’, ‘/exr2/png/teapot_.####.png’, 0, 30)
‘’’
try:
os.makedirs(os.path.dirname(d))
except:
pass

for frame in range (startframe, endframe + 1):
    fileIn = ReplaceFilenameHashesWithNumber( source, frame )
    if not os.path.isfile(fileIn):
        print 'File does not exist:', fileIn
        continue

    fileOut = ReplaceFilenameHashesWithNumber( destination, frame )
    img = Draft.Image.ReadFromFile( fileIn )
    img.ApplyGamma( 1.0 / 2.2 )
    img.WriteToFile( fileOut )
    print 'converted:', fileOut

s = ‘C:\Users\Martini\Desktop\trash\draft\imgs\exr2\teapot_.####.exr’
d = ‘C:\Users\Martini\Desktop\trash\draft\imgs\exr2\teapot_teapot_h264proxy.mov’
renderDraftQT(s, d, 0, 30)

s = ‘C:\Users\Martini\Desktop\trash\draft\imgs\exr2\teapot_.####.exr’
d = ‘C:\Users\Martini\Desktop\trash\draft\imgs\exr2\png\teapot_.####.png’
renderDraftPNG(s, d, 0, 30)[/code]

Privacy | Site terms | Cookie preferences