Closed maptz closed 1 year ago
Ignore this! Finger trouble:
Correct function below:
def create_retime(f : aaf2.file.AAFFile, audio_clip):
# See here: https://github.com/markreidvfx/pyavb/blob/main/examples/avb2aaf.py#L21
op_def = f.create.OperationDef('01030202-0200-0000-060e-2b3404010101', 'Audio Warp', '')
f.dictionary.register_def(op_def)
op_def.media_kind = 'sound'
op_def['NumberInputs'].value = 1
op_def['IsTimeWarp'].value = False
op_def['Bypass'].value = 0
op_def['OperationCategory'].value = "OperationCategory_Effect"
param = f.create.ParameterDef("f7ffed29-fc8e-43ed-943a-4b57b5c157ee", "AvidMotionPulldown", "", 'aafInt32')
f.dictionary.register_def(param)
op_def.parameters.append(param)
param = f.create.ParameterDef("8dde1839-6862-4874-a1e9-4fbd1164f22a", "AvidMotionOutputFormat", "", 'aafInt32')
f.dictionary.register_def(param)
op_def.parameters.append(param)
param = f.create.ParameterDef("5b22ff71-c51b-11d3-a069-006094eb75cb", "AvidPhase", "", 'aafInt32')
f.dictionary.register_def(param)
op_def.parameters.append(param)
param = f.create.ParameterDef("72559a80-24d7-11d3-8a50-0050040ef7d2", "SpeedRatio", "", 'Rational')
f.dictionary.register_def(param)
op_def.parameters.append(param)
param = f.create.ParameterDef("1c5a02d5-e503-4ca6-8617-d7914bb8ac03", "AvidMotionInputFormat", "", 'aafInt32')
f.dictionary.register_def(param)
op_def.parameters.append(param)
op_group = f.create.OperationGroup("Audio Warp", media_kind="sound")
sequence = f.create.Sequence(media_kind="sound")
sequence.components.append(audio_clip)
# op_group.segments.append(sequence)
op_group['InputSegments'].append(sequence)
param = f.create.ConstantValue('AvidMotionPulldown', 0)
op_group.parameters.append(param)
param = f.create.ConstantValue('AvidMotionOutputFormat', 2)
op_group.parameters.append(param)
param = f.create.ConstantValue('AvidPhase', 0)
op_group.parameters.append(param)
param = f.create.ConstantValue('SpeedRatio', aaf2.misc.AAFRational(1001/960))
op_group.parameters.append(param)
param = f.create.ConstantValue('AvidMotionInputFormat', 2)
op_group.parameters.append(param)
op_group.length = audio_clip.length
return op_group
Hi,
I'm trying to mimic an AudioWarp effect that's applied to some 23.98 fps audio footage on my 25 fps Avid timeline sequences using PYAAF2.
To do this, I need to create an Operation Group. I've tried following along the avb2aaf example, but can't get my OperationGroup to work without an error. The
audio_clip
variable is a SourceClip. Essentially, I can either add the SourceClip to a Sequence directly, or add the retimed clip to the same sequence via the followingcreate_retime
function (a1_sequence.components.append(a1_clip)
.Any help?
When I close the AAF file, I get the following error:
Can you advise what I might be doing wrong?