You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Trying to get all the mp4 files in a directory added to my project, then added to the active sequence. I'm aware a loop could add them one by one, but I'm wondering if it's possible to use insertClip to add multiple at once, similar to dragging them onto the timeline. I'm a bit of a novice when it comes to coding, so perhaps my syntax is wrong. Here's my code:
import pymiere
import os
from pymiere.wrappers import time_from_seconds
project = pymiere.objects.app.project
directory = r'D:\Media_Folder'
media_path = [os.path.join(directory, filename) for filename in os.listdir(directory) if filename.endswith('.MP4')]
# import media into Premiere
success = project.importFiles(
media_path, # can import a list of media if there are no brackets around media_path
suppressUI=True,
targetBin=project.getInsertionBin(),
importAsNumberedStills=False
)
#find media we imported
items = project.rootItem.findItemsMatchingMediaPath(media_path, ignoreSubclips=False)
#add clip to active sequence
project.activeSequence.videoTracks[0].insertClip(items[0], time_from_seconds(0))
The text was updated successfully, but these errors were encountered:
Trying to get all the mp4 files in a directory added to my project, then added to the active sequence. I'm aware a loop could add them one by one, but I'm wondering if it's possible to use insertClip to add multiple at once, similar to dragging them onto the timeline. I'm a bit of a novice when it comes to coding, so perhaps my syntax is wrong. Here's my code:
The text was updated successfully, but these errors were encountered: