pymiere icon indicating copy to clipboard operation
pymiere copied to clipboard

Adding Transitions using Pymiere - example included

Open seanmcnally98 opened this issue 1 year ago • 1 comments

Hey there, this isn't an issue, but a request to add this example to the documentation. It took me a long time to figure out how to add transitions between clips using pymiere, but I finally figured it out. This code will add a 25 frame cross dissolve at the third clip on V1. You can edit the duration, which transtion is used (by name) and which clip on which track will be targeted.

This is working code!

import pymiere

qe_project = pymiere.objects.qe.project

track = qe_project.getActiveSequence().getVideoTrackAt(0) # Example: target V1 (since indexing starts at 0)

# Specify the target clip index (0-based)
target_clip_index = 2  # Example: target the third clip (since indexing starts at 0)

clip = track.getItemAt(target_clip_index)
clip.addTransition(qe_project.getVideoTransitionByName("Cross Dissolve"), False, '00;00;00;25')

print(f"Transition added to clip at index {target_clip_index}")
print("Done")

Disclaimer, in my addTransition function, I have no idea what the "False" boolean does. In fact, the source I got this from has no idea what it does either. But, it works!

seanmcnally98 avatar Jan 28 '24 08:01 seanmcnally98

Hel @seanmcnally98 Its so weird that these codes are no longer existing anywher (only onthose youtube videos) and that youhad to watch the whole video to find that code..

APISeeker avatar Jan 29 '24 07:01 APISeeker