10.6: Use AppleScript for precise trimming in QuickTime X

Mar 08, '10 07:30:00AM

Contributed by: Anonymous

Snow Leopard only hintMost of us know that Quicktime X, included with Snow Leopard, can trim movie and audio files. However, this trim is less than precise, as you cannot specify an exact trim start and stop point. Worse yet, if you want to make 10 minute segments for YouTube, you have to write down the last trim end time, undo the previous trim after uploading, and hope the trim slider will let you select the same trim point to start your next clip. What a pain.

Enter AppleScript -- trim is a scriptable function. Open your movie in Quicktime X, and open the AppleScript Editor in the Application » Utilities folder. In the AppleScript Editor enter this script:

tell application "QuickTime Player"
  activate
  trim document 1 from start_trim to end_trim
end tell
Replace start_trim and end_trim with the time, in seconds, at which you wish to start and end the trim. For example, if you want to create a 10 minute (600 seconds) clip, starting from the beginning of the movie, you would type this for the trim line:
trim document 1 from 0 to 600
After you have typed in your start and stop point for your trim, hit Compile in the ApplesSript Editor window, then hit Run. You will then have a perfectly trimmed movie. You can then change the values to create the second clip, etc.

I am sure an AppleScript guru will figure out a way to automatically separate a movie into 10-minute clips for YouTube. Feel free to post suggestions in the comments!

Comments (8)


Mac OS X Hints
http://hints.macworld.com/article.php?story=20100305070247890