Last active
March 24, 2025 14:28
-
-
Save GarryLai/27d9fcc08ab02c00f8f1d0acbc5b85ee to your computer and use it in GitHub Desktop.
Agisoft Metashape videos batch import
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # | |
| # Metashape videos batch import v1.0 | |
| # Author: Garry Lai | |
| # Usage: "Tools" --> "Run script" | |
| # | |
| import Metashape | |
| doc = Metashape.app.document | |
| chunk = doc.chunk | |
| files = Metashape.app.getOpenFileNames('Import Videos', filter='All Formats (*.avi *.flv *.mov *.mp4 *.wmv);;All Files (*.*)') | |
| print('Files to import:', files) | |
| out_path = Metashape.app.getExistingDirectory('Output folder') | |
| if out_path == '': | |
| Metashape.app.messageBox("Aborted by user") | |
| files = [] | |
| for file in files: | |
| filename = file.split('\\')[-1].split('/')[-1].split('.')[0] | |
| print('Import:', filename) | |
| chunk.importVideo(path=file, image_path=f"{out_path}/{filename}-{{filenum}}.png", frame_step=Metashape.FrameStep.SmallFrameStep) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment