因為要上傳影片到 Youtube
必須將影片分割成數個不超過10分鐘長度的小片段
可是在 Mac OS X 下好像沒有好用的軟體
可又不想用 Quicktime 來一個一個手動分割
所以參考了一些資料後
寫了一個 AppleScript
File name : splite.scpt
(* Splite Quicktime Movie into equally sized for Youtube YF Chen yfc@yfchen.com *) set sourceFile to choose file with prompt "choose video file as source" set theFolder to (choose folder with prompt "Choose a folder for the slices:") as text tell application "Finder" my splitteVideo(sourceFile, theFolder) end tell on splitteVideo(sourceFile, theFolder) tell application "QuickTime Player 7" activate try open sourceFile on error display dialog "Open a movie first" buttons ["OK"] with title "Error" return end try -- get active movie set sourceDoc to document 1 set theDuration to duration of sourceDoc set theTitle to name of sourceDoc set DurOverlap to 2 -- 2sec overlaping set DurScal to (90 * 1000) -- calculate segments set DurCut to (9 * 60) -- 9 min set DurDoc to (duration of sourceDoc) / DurScal set NumOfSeg to DurDoc div DurCut -- loop each segment repeat with i from 0 to NumOfSeg -- set segment selection set durStart to (i * DurCut) * DurScal set durEnd to ((i + 1) * DurCut + DurOverlap) * DurScal if durEnd > theDuration then set durEnd to theDuration end if set selection start of sourceDoc to durStart set selection end of sourceDoc to durEnd -- copy selection into new movie copy sourceDoc set newdoc to make new document paste newdoc set theSlice to i as integer as string set theFile to (theTitle & "_" & theSlice) & ".mov" as string set theFile_full to (theFolder & theFile) as string try save self contained newdoc in theFile_full end try close document theFile end repeat close sourceDoc quit end tell end splitteVideo