Hey every one. I’m working on a project at work, and as a newbie to apple script ( i know some other languages) this is bothering me.
I have a server who plays video clips during the recording of a tv show. Afterwards, i play the whole playlist of previously played clips and record it on tape for archiving/backup. The playlist app generates a file wih clip names and time code on the tape . ( vtr and computer are sync).
My goal is to do that automatically and digitally ( we’re runing out of tapes :p)
I started by scheduling a recording on a mac pro ( sdi input).
I play my playlist on the video server and it records on the mac.
It stops automaticaly, and send the file into a folder.
Now that i have the whole playlist in one file, i need to segment it in multiples files, with proper durations and names.
For the parsing, i generate with the video server a .log file is like this :
12:32:45, clip1, 00:00:04:21, 12:32:49, clip2, 00:02:23:12
In this exemple, the clip1 was recorded on 12h32,45 and have a duration of 4 sec and 21frames.
First, i need to parse the datas in list or array i think, then process the duration in a way that applescript understand ( i dont know if i can specify frames)
Then trim the movie according to the duration specified in my log file.
I want the clips to be exported with proper names.
What i have done yet is a folder action that opens any new file in the folder, trims it to a specific durationand export it.
on adding folder items to this_folder after receiving this_file
Set file_name to name of (info for name of this_file)
tell application "QuickTime Player"
Activate
Open this_folder & file_name
set the movie_length to the duration of document 1
set start_time to 0
set end_time to 60
set current time of document 1 to start_time
trim document 1 from start_time to end_time
set the target_file to ((path to movies folder as string) & base_name & "-" & (i as string) & ".mxf")
export document 1 in file target_file using settings preset "Computer"
delay 1
my reset_movie()
set start_time to end_time
set current time of document 1 to 0
end tell
end adding folder items to
on reset_movie()
tell application "System Events"
tell process "QuickTime Player"
keystroke "z" using command down
keystroke "q" using command down
end tell
end tell
delay 2
end reset_movie
It works well exept for my reseting part. When a first trimm is done, the auto “cmd z” doesnt work because the export windows is in front, therefore, quicktile doesnt cancel, and retrim on the previously trimmed portion…
It doesnt close either…
My two questions are :
- how can i parse the log file properly
- how can i loop the triming and exporting action using those datas
- and close quicktime afterwards.
Thank you for your time, andthanks for your help.