Automating the extraction of video clips by start and end times


I have a large, somewhat tedious, project ahead of me and would rather automate it than do it by hand. I have a folder full of videos (game films) and list of clips from each that I want to extract and export. Conceptually, I need a video editor that I can automate to open a file, define a clip based on data file of start and end points on the timeline, export that clip (ideally with a name from the same data file), and then move to the next clip. Generally speaking I was thinking of a video editor that I can drive using keyboard maestro to define each clip, export, and repeat. Has anyone does anything similar? Thanks!


I would use ffmpeg to do this rather than trying to script a video editor app.

You could still run that via an Execute Shell Script action if you really wanted to utilise Keyboard Maestro.

Thanks! I skimmed through the documention. It’s not clear that ffmpeg will work on a M1 mac, at least natively, but some folks seemed to have made it work. I’ll give it a shot.

If you check Does FFmpeg work on Apple Silicon? - Does It ARM, at, you’ll see it does via Homebrew.

You can see the formulae details here:

Homebrew is almost certainly the easiest way to get it onto your Apple Silicon Mac.

Yes! I was just about to update this thread. After watching a couple of Youtube tutorials, I did the Homebrew install of ffmpeg and ran a quick test. All good.

If anyone is interested, here’s a sample command to grab a 10 second clip starting at minute 15 and outputting it to a new file.

ffmpeg -ss 00:15:00 -i test-video.mp4 -pix_fmt yuv420p -to 00:00:10 -c:v copy -c:a copy result-video.mp4

Source and details:

Thanks again for your time!