Batch Conversion/Resize and Stitch of Quicktime Videos

Hi folks.

I’ve written a script which takes I want to process AVI movies in turn, resizing the video then adding a clip to the beginning (intro) and a clip to the end (credits). So far I’ve got the code below and its partially working, except the resize of the AVI isn’t working properly. Its just adding the video at its original size. I need to resize the AVI to 720x400 (the intro and credits clip are already this size).

I’d appreciate and help/input/recommendations on this. :slight_smile: Thank you!


-- set paths to the intro and credits movie
set intro to "Users:scott:Desktop:source:intro.mov"
set credits to "Users:scott:Desktop:source:credits.mov"
set export_settings to "Users:scott:Desktop:source:settings"

-- write all movies to this file
do shell script "find /Users/scott/Desktop -iname '*.avi*' > /Users/scott/Desktop/movies"

set movieFile to ":Users:scott:Desktop:movies" as alias

-- open the movie resulting file and process each video
open for access movieFile
tell application "Finder"
	set Names to paragraphs of (read movieFile)
	repeat with nextMovie in Names
		if length of nextMovie is greater than 0 then
			tell application "QuickTime Player"
				make new document
				open intro
				tell document 1
					rewind
					select all
					copy
					select none
				end tell
				close document 1 saving no
				tell document 1
					add
					select none
				end tell
				
				open (nextMovie & ".tmp.mp4")
				tell document 1
					rewind
					select all
					copy
					select none
				end tell
				close document 1 saving no
				tell document 1
					add
					select none
				end tell
				
				open credits
				tell document 1
					rewind
					select all
					copy
					select none
				end tell
				close document 1 saving no
				tell document 1
					set scale to normal
					add
					select none
				end tell
				
				-- now export using the settings file and give it up to an hour to process
				with timeout of 3600 seconds
					export document 1 to (nextMovie & ".mp4") as QuickTime movie using settings export_settings with replacing
				end timeout
				close document 1 saving no
			end tell
		end if
	end repeat
end tell
close access movieFile