Quick Export
The functionality of Quick Export can be accessed via Python. This export mode provides an accelerated process but is less customizable when compared with the Export System.
To execute a Quick Export you need to create a dictionary with the settings for that export, then using a TimelineDirectExport object you’re able to export the sequence through the method exportSequence. The execution of this method is synchronous (blocking).
Note
Currently there are no current default values for the settings so every key must be set for that specific codec, see examples below
from hiero.core import TimelineDirectExport
from hiero.core import Sequence
import os.path
# Set up a new project and bin
myProject = hiero.core.newProject("My Project")
clipsBin = myProject.clipsBin()
clipsBin.addItem(hiero.core.Bin("Bin 1"))
# Create a new clip with sample resources from the guide
resourcesPath = os.path.join(pathToHieroPythonDevGuide, "Resources")
clip1 = clipsBin.createClip(os.path.join(resourcesPath, "colour_bars.mov"))
# Create a new sequence and add the clip to a video track
sequence = hiero.core.Sequence("NewSequence")
clipsBin.addItem(hiero.core.BinItem(sequence))
track = hiero.core.VideoTrack("VideoTrack")
trackItem = track.createTrackItem("Track 1")
trackItem.setSource(clip1)
track.addItem(trackItem)
sequence.addTrack(track)
# Create a new TimelineDirectExport object
exportObj = TimelineDirectExport()
# Settings dictionary to export the sequence into a ProRes encoded mov
# Note that the audio related settings still need to be set even if the sequence has no audio track
prores_export = {
"Audio Codec" : "linear PCM (wav)",
"Bit Depth" : "32 bit(float)",
"Codec" : "Apple ProRes",
"Codec Profile" : "ProRes 4:4:4:4 XQ 12-bit",
"Data Range" : "Video Range",
"Fast Start" : "True",
"Include Audio" : "False",
"Output Channels" : "stereo",
"Reformat" : "None",
"Sample Rate" : "48000 Hz",
"Views" : "main",
"Write Timecode" : "True",
"YCbCr Matrix" : "Auto",
"colorspace" : "default",
"ocioDisplay" : "default",
"ocioView" : "sRGB",
"transformType" : "colorspace"
}
# Settings dictionary to export the sequence into a H264 encoded mov with custom reformat settings
h264_export = {
"Audio Codec" : "linear PCM (wav)",
"B Frames" : "0",
"Bit Depth" : "32 bit(float)",
"Bitrate" : "28000.0",
"Bitrate Tolerance" : "0",
"Codec" : "H.264",
"Codec Profile" : "High 4:2:0 8-bit",
"Data Range" : "Video Range",
"Fast Start" : "True",
"Format_height" : "720",
"Format_name" : "HD_720",
"Format_pixelAspect" : "1.0",
"Format_width" : "1280",
"GOP Size" : "12",
"Include Audio" : "True",
"Output Channels" : "stereo",
"Quality" : "High",
"Quantizer Max" : "3",
"Quantizer Min" : "1",
"Reformat" : "Custom",
"Sample Rate" : "48000 Hz",
"Views" : "main",
"Write Timecode" : "True",
"YCbCr Matrix" : "Auto",
"center" : "True",
"colorspace" : "default",
"ocioDisplay" : "default",
"ocioView" : "sRGB",
"resize" : "width",
"transformType" : "colorspace"
}
# Export the sequence using Quick Export into a ProRes mov
exportObj.exportSequence(sequence, os.path.join(outputPath, "quick_prores_export.mov"), prores_export)
# Export the sequence using Quick Export into a H264 mov
exportObj.exportSequence(sequence, os.path.join(outputPath, "quick_h264_export.mov"), h264_export)