Problem solved. It looks like it was due to how a missing logo was being handled. I’ve fixed that now, updated the code, and made another small change that should improve performance a bit. Could you check this to see if your other problems are fixed now too? (You mentioned it appeared to be fast-forward.) Note: You will need the newer version of Draft to run this updated script, as I changed deprecated method calls with the updated forms.
Cheers,
Andrea
[code]import sys
import os
import datetime
import copy
import xml.etree.ElementTree as xml
import Draft
from DraftParamParser import *
print “Draft Version: %s” % Draft.LibraryInfo.Version()
#CHANGE ME! Path to the Deadline Repository root
deadlineRepo = “\fx-deadline\deadline\”
#CHANGE ME! Path to an image containing the background of the slate frame
slateFrame = “\\fx-deadline\deadline\Draft\Slate_Montage5K_new.png”
logoFrame = “\\fx-deadline\deadline\Draft\FrimaFX.png”
#The argument name/types we’re expecting from the command line arguments
expectedTypes = dict()
expectedTypes[‘frameList’] = ‘’
expectedTypes[‘inFile’] = ‘’
expectedTypes[‘outFile’] = ‘’
expectedTypes[‘username’] = ‘’
expectedTypes[‘entity’] = ‘’
expectedTypes[‘version’] = ‘’
#expectedTypes[‘deadlineJobID’] = ‘’
expectedTypes[‘startFrame’] = ‘’
expectedTypes[‘endFrame’] = ‘’
#Parse the command line arguments
params = ParseCommandLine( expectedTypes, sys.argv )
inFilePattern = params[‘inFile’]
params[‘frameList’] = “%d-%d” % (params[‘startFrame’], params[‘endFrame’])
frames = range( params[‘startFrame’], params[‘endFrame’] + 1 )
#frames = FrameRangeToFrames( params[‘frameList’] )
if(True):
(outDir, outFile) = os.path.split(params[‘outFile’])
(outBase, outExt) = os.path.splitext(outFile)
outFolder = os.path.basename(outDir)
if not os.path.exists(os.path.join(outDir, ‘1080p’)):
os.makedirs(os.path.join(outDir, ‘1080p’))
#if not os.path.exists(os.path.join(outDir, ‘halfrez’)):
os.makedirs(os.path.join(outDir, ‘halfrez’))
#if not os.path.exists(os.path.join(outDir, ‘fullrez’)):
os.makedirs(os.path.join(outDir, ‘fullrez’))
else:
(outBase, outExt) = os.path.splitext(params[‘outFile’])
outWidth = 1920
outHeight = 1080
#halfWidth = 2560
#halfHeight = 1350
slateFrames = 1
outLut = Draft.LUT.CreateRec709()
for eye in [‘l’,‘r’]:
#Build up the encoders
doOutSingleEye = False
if not ‘%v’ in outBase:
doOutSingleEye = True
outBaseEye = outBase.replace( ‘%v’, eye )
#outBaseEyeHalf = outBase.replace( ‘%v’, eye ) + “-Hres”
#outBaseEyeFull = outBase.replace( ‘%v’, eye ) + “-Fres”
#Appends (#) on the end of the filename until we have a unique name
increment = 2
newFileName = ‘%s/1080p/%s%s’%(outDir, outBaseEye, outExt)
while os.path.exists( newFileName ):
newFileName = ‘%s/1080p/%s (%d)%s’%(outDir, outBaseEye, increment, outExt)
increment += 1
#Appends (#) on the end of the filename until we have a unique name
#increment = 2
#newFileNameHalf = ‘%s/halfrez/%s%s’%(outDir, outBaseEyeHalf, outExt)
#while os.path.exists( newFileNameHalf ):
newFileNameHalf = ‘%s/halfrez/%s (%d)%s’%(outDir, outBaseEyeHalf, increment, outExt)
# increment += 1
MJPEGencoder = Draft.VideoEncoder( newFileName, 24.0, outWidth, outHeight, 75000, “MJPEG” )
MJPEGencoderHRes = Draft.VideoEncoder( newFileNameHalf, 24.0, halfWidth, halfHeight, 325000, “MJPEG” )
#Annotation info used for burn ins
annotationInfo = Draft.AnnotationInfo()
annotationInfo.PointSize = int( outHeight * 0.017 )
annotationInfo.Color = Draft.ColorRGBA( 1.0, 1.0, 1.0, 1.0 )
#Annotation info used for burn ins
annotationInfoBig = Draft.AnnotationInfo()
annotationInfoBig.PointSize = int( outHeight * 0.02 )
annotationInfoBig.Color = Draft.ColorRGBA( 1.0, 1.0, 1.0, 1.0 )
#Annotation info used for burn ins
annotationInfoFrame = Draft.AnnotationInfo()
annotationInfoFrame.PointSize = int( outHeight * 0.025 )
annotationInfoFrame.Color = Draft.ColorRGBA( 1.0, 1.0, 1.0, 1.0 )
#prep the Slate Frame
try:
slate = Draft.Image.ReadFromFile( slateFrame )
slate.SetChannel( ‘A’, 1.0 )
except:
slate = Draft.Image.CreateImage( outWidth, outHeight )
slate.SetToColor( Draft.ColorRGBA( 0.0, 0.0, 0.0, 1.0 ) )
if ( slate.width != outWidth or slate.height != outHeight ):
slate.Resize( outWidth, outHeight, “fit” )
#sets up the text on the slate frame
slateAnnotations = [params[‘entity’], params[‘version’], params[‘username’], datetime.datetime.now().strftime("%m/%d/%Y %I:%M %p"), params[‘frameList’]]
for i in range (0, 4):
annotation = Draft.Image.CreateAnnotation(slateAnnotations[i], annotationInfo)
slate.CompositeWithPositionAndAnchor(annotation, 0.23, 0.446 - (i * 0.03), Draft.Anchor.NorthWest, Draft.CompositeOperator.OverCompositeOp)
annotation = Draft.Image.CreateAnnotation(slateAnnotations[4], annotationInfo)
slate.CompositeWithPositionAndAnchor(annotation, 0.327, 0.24, Draft.Anchor.South, Draft.CompositeOperator.OverCompositeOp)
oFrameRangeSplit = slateAnnotations[4].split(’-’)
oFrameCount = str(int(oFrameRangeSplit[1]) - int(oFrameRangeSplit[0]) + 1)
annotation = Draft.Image.CreateAnnotation(oFrameCount, annotationInfoBig)
slate.CompositeWithPositionAndAnchor(annotation, 0.251, 0.237, Draft.Anchor.South, Draft.CompositeOperator.OverCompositeOp)
#encode the slate frames at the start of the video
print( “Encoding Slate Frames…” )
for i in range( 0, slateFrames ):
MJPEGencoder.EncodeNextFrame( slate )
#MJPEGencoderHRes.EncodeNextFrame( slate )
studioAnnotation = Draft.Image.CreateAnnotation( “PROJECT”, annotationInfo )
entityAnnotation = Draft.Image.CreateAnnotation( “%s %s” % (params[‘entity’], datetime.datetime.now().strftime("%m/%d/%Y")), annotationInfo )
dateAnnotation = Draft.Image.CreateAnnotation( datetime.datetime.now().strftime("%m/%d/%Y"), annotationInfo )
shotAnnotation = Draft.Image.CreateAnnotation(params[‘entity’], annotationInfo)
try:
logo = Draft.Image.ReadFromFile( logoFrame )
logo.Resize(int(0.1852outHeight), int(0.0657outHeight))
except:
logo = None
#annotationInfo.BackgroundColor = Draft.ColorRGBA( 0.0, 0.0, 0.0, 1.0 )
#initialize the frame to None
bgFrame = None
#Main encoding loop
for frameNumber in frames:
print( “Processing Frame: %d…-1” % frameNumber )
inFile = inFilePattern.replace( '%v', eye )
inFile = ReplaceFilenameHashesWithNumber( inFile, frameNumber )
if os.path.exists( inFile ):
try:
#try to read in the frame
bgFrame = Draft.Image.ReadFromFile( inFile )
except:
#failed to read in, that's OK, we'll just re-encode the previous frame
pass
#create a black frame if we couldn't read in, and don't have a previous frame to encode
if bgFrame is None:
bgFrame = Draft.Image.CreateImage( outWidth, outHeight )
bgFrame.SetToColor( Draft.ColorRGBA( 0.0, 0.0, 0.0, 1.0 ) )
elif ( bgFrame.width != outWidth or bgFrame.height != outHeight ):
bgFrame.Resize( outWidth, outHeight, 'fit' )
#Do the frame burnins
bgFrame.SetChannel('A', 1.0)
bgFrame.Composite(bgFrame, 0, 0, Draft.CompositeOperator.OverCompositeOp)
framesAnnotation = Draft.Image.CreateAnnotation( str( frameNumber ), annotationInfoFrame )
bgFrame.CompositeWithPositionAndAnchor( framesAnnotation, 0.825, 0.062, Draft.Anchor.SouthEast, Draft.CompositeOperator.OverCompositeOp )
#don't redo the other burnins, or the LUT since we've already done it for the last frame
#if os.path.exists( inFile ):
bgFrame.CompositeWithPositionAndAnchor( studioAnnotation, 0.0, 1.0, Draft.Anchor.NorthWest, Draft.CompositeOperator.OverCompositeOp )
bgFrame.CompositeWithPositionAndAnchor( dateAnnotation, 0.0, 0.0, Draft.Anchor.SouthWest, Draft.CompositeOperator.OverCompositeOp )
bgFrame.CompositeWithPositionAndAnchor( shotAnnotation, 0.5, 0.0, Draft.Anchor.South, Draft.CompositeOperator.OverCompositeOp )
outLut.Apply( bgFrame )
#if os.path.exists( inFile ):
if logo is not None :
bgFrame.CompositeWithPositionAndAnchor( logo, 0.95, 0.05, Draft.Anchor.SouthEast, Draft.CompositeOperator.OverCompositeOp )
MJPEGencoder.EncodeNextFrame( bgFrame )
#MJPEGencoderHRes.EncodeNextFrame( burned )
#Finalize the encoding process
MJPEGencoder.FinalizeEncoding()
#MJPEGencoderHRes.FinalizeEncoding()
if doOutSingleEye:
break[/code]