Strange problem with AppleScript script for joining Movies with Chapters using QuickTime Pro
I have an ApleScript script (droplett) that concatenates individual movie files into one movie, and makes chapters markers using the movie file names. The script works great - almost. When I view the file on my Mac, the chapters are spot-on. But when I view the same file on my iPod Touch, the chapter timestamps are off.
Here's the truly strange thing: I used Metadata Hootenanny to look at the chapters in the movie, and the timestamps look correct. But if I use MH to save the chapter info to a text file, the timestamps in the text file don't match what the MH GUI says. In fact, the timestamps in the text file appear to be what the iPod Touch uses when viewing the movie.
Anyone know how this is possible? I'll include the script below, but I'd like to know how this is even possible, regardless of what I've done wrong in my script.
Any help will be apprecitated.
Here's the script: CAVEAT: I'm very new to AppleScript, and I know I should be checking for unexpected conditions, etc. Right now I just want to get it working, then I'll deal with that.
on openinput
repeat with i from 1 to count of input
set this_item to (item i of input)
-- NOTE: This is a simplified version of how I really get the chapter name.
-- I didn't want to clutter up the example
tell application "Finder" to set chapter_name to (name of this_item)
tell application "QuickTime Player 7"
if i is equal to 1 then
makenewdocument
end if
openthis_item
tell document 1
rewind
select all
copy
set clip_length to the duration
end tell
closedocument 1 savingno
tell document 1
select none
set old_movie_length to the duration
set current time to old_movie_length
paste
-- NOTE: All the movies I'm concatenating already have one chapter in them.
-- I don't know if this code will work if that's not true, so if you use
-- this script and run into problems, that might be the reason.
set time of chapter i to old_movie_length
set duration of chapter i to clip_length
set name of chapter i to chapter_name
end tell
end tell
end repeat
quit
end open
Thanks for any help!
Dan