How to get Quicktime to export to MPEG4. Help Please.

Hi Everyone-

I am still trying to write an applescript that will take a sound file in QuickTime and break into 3 segments. I have most of the code figured out including breaking the original file into three segmented files, but I keep getting an error when I try to get QuickTime to export the new file as MPEG4. Here is the code so far:


tell application "QuickTime Player"
	activate
	set new_name to name of movie 1
	set new_name to characters 1 thru -5 of new_name as string
	set sav_dir to "Save directory name"
	set sav_name to sav_dir & new_name
	set current_time to current time of movie 1
	set start_point1 to current_time
	set end_point1 to (start_point1 + (3700 * (time scale of movie 1)))
	select movie 1 at start_point1 to end_point1
	copy movie 1
	make new movie
	paste movie 1
	rewind movie 1
	--save movie 1 in sav_name & "p1"
	export movie 1 to sav_name & "p1" as MPEG4 using default settings
end tell

I get the following error:

And applescript highlights the following line in the script:


export movie 1 to sav_name & "p1" as MPEG4 using default settings

Any ideas on how to get this to work? I can get Quicktime to export the file to the correct format manually, but I would really like to automate this process. I can get QT to save the file, but it is still in aiff format.

Thanks in advance for the help.
SA
:smiley:

You need to set the file name before exporting the file:

set new_file to (_Destination  & ".mp4") as string
export movie 1 to file new_file as MPEG4 using default settings with replacing

For good error checking enclose these statements in a try on error