Exemplo n.º 1
0
            raise

        if "ImageWidth" in data and "ImageHeight" in data:
            configWidth = int(data["ImageWidth"])
            configHeight = int(data["ImageHeight"])

        if data["TilesCropped"].lower(
        ) != "true" and data["TilesCropped"] != "1":
            print("Tiles are not cropped")
        else:
            print("Tiles are cropped")

        if "BackgroundSource" in data:
            print("Background Source Provided")
            try:
                imageInfo = Draft.ImageInfo()
                backgroundImage = Draft.Image.ReadFromFile(
                    data["BackgroundSource"], imageInfo)
                backgroundWidth = backgroundImage.width
                backgroundHeight = backgroundImage.height
                channelNames = backgroundImage.GetChannelNames()
                assembler.SetSize(backgroundWidth, backgroundHeight)
                assembler.AddTile(backgroundImage, 0, 0)

                print("Background Source Found")
                print("Final Image Dimensions = " + str(backgroundWidth) +
                      "x" + str(backgroundHeight))
            except:
                if errorOnMissingBackground:
                    print("Unable to read background source image: " +
                          str(data["BackgroundSource"]))
        print "Using LUT {}".format(lutName)
        lut = Draft.LUT.CreateOCIOProcessorFromFile(lutName)
    except:
        print "Unexpected error looking for LUT", sys.exc_info()[0]

        lut = None
        pass

#
# Initialize the video encoder.
#
print "Creating {3} video encoder ({0}x{1} @ {2}fps)".format(
    outWidth, outHeight, framerate, toCodec)
# Create a Draft.ImageInfo object used to extract a Draft.Timecode object
imageInfo = Draft.ImageInfo()
firstFile = ReplaceFilenameHashesWithNumber(inputPath, frames[0])
firstFrame = Draft.Image.ReadFromFile(firstFile, imageInfo)

# If timecode is found, specify the timecode parameter when creating the encoder
print("The first frame timecode starts at: %s" % imageInfo.timecode)
if (imageInfo.timecode):
    if params['projectAppendSlate'] == "True":
        # If the slate is appended, the initial TC should be one frame less than the actual frame
        firstTimecode = str(imageInfo.timecode).split(":")  # "12:40:10:15"
        firstTimecodeHour = firstTimecode[0]
        firstTimecodeMinutes = firstTimecode[1]
        firstTimecodeSeconds = firstTimecode[2]
        firstTimecodeFrames = firstTimecode[3]

        if (firstTimecodeFrames == "00"):