# Quicktime export via applescript slow



## aliensub (Sep 22, 2006)

I have modified an applescript to convert .wav 32 bit to 24 bit files. For this I use quicktime pro.
The script itself works fine but for some odd reason when I use the script the export takes alot longer than when doing it manually from quicktime.
The export settings is of course the same.

Hope anyone can help me solve this issue


----------



## Mikuro (Sep 22, 2006)

I've never experienced this issue myself, but if I may take a stab at your intent and recommend a possibly better solution....

Have you tried using QTAmateur instead of QuickTime Player? It gives you the same encoding power as QuickTime Pro, but it allows you to queue files, so you can easily encode a whole bunch of files to the same output format in one step. If your reason for writing the script was to tack on queue support to QuickTime Player, give QTAmateur a try.

If I'm way off base, could you provide some more info, like your QT version and if possible your script?

Also, can you see any notable difference in CPU usage in Activity Monitor?


----------



## AeroQ (Sep 25, 2006)

Hi,

I have no idea why it's slower through script than through QT Pro.
Anyway, if you want to convert a group of files in one shot, you can try Batch Export command in SimpleMovieX.

http://www.aeroquartet.com/SimpleMovieX/

Note that I'm the developer of this little app. You can use it for free, yet registered version is 2x faster.

Regards.


----------



## aliensub (Sep 28, 2006)

Sorry for the late response.
Both QTAmateur and SimpleMovieX doens't have the option to export to 24 bit, only 8 & 16 bit (Will that change in a future version AeroQ?)
And yes Mikuro, the only reason for this is to be able to batch process many files. Often I have to change around 100 - 400 files which gets a little annoying doing it manually from QT.....

I have been running some tests to nail this thing and here is some data:
Exporting a 48kHz / 32 bit wave file from Quicktime manually took around 15 sec and ran around 15% on the CPU.
Exporting the exact same file through the script took around 1.20 min. and ran around 25% on the CPU. The time is calculated from when quicktime itself starts the export.
All settings is of course the same and the exported files has been cross checked to make sure they where the same.
You can reproduce it by taking any wave file export it too 48kHz / 32 bit and then run the other exports.

I really hope someone can help me with this....

The script itself is here:

```
on run
	choose folder with prompt "Change audio files from these folders:" with multiple selections allowed
	open (result)
end run
on open droppedItems
	tell application "QuickTime Player"
		activate
		close every window
	end tell
	
	repeat with thisItem in droppedItems
		if (folder of (info for thisItem without size)) is true then
			list folder thisItem without invisibles
			
			
			repeat with thisFile in (result)
				tell application "QuickTime Player"
					open ((thisItem as Unicode text) & thisFile)
					
					if (can export (front movie) as wave) is true then
						try
							export front movie to ("Powerbook:Users:danny:Documents:Audio:Converted:test2:" & thisFile) as wave using settings file "Powerbook:Users:danny:Documents:Audio:Converted:exportsettings.set"
						on error errorMsg number errorNum
							display dialog "Error (" & errorNum & "):" & return & return & errorMsg buttons "OK" default button 1 with icon caution
						end try
					else
						display dialog "QuickTime Player can't export " & (thisFile as Unicode text) & " as wave." buttons "OK" default button 1 with icon caution
					end if
					
					close front movie
				end tell
			end repeat
			
		end if
	end repeat
	
	quit application "QuickTime Player"
end open
```


----------



## lindea (Oct 4, 2006)

I have a similar problem. 
I do audio exports from mp4 to AIF (44.1, 16) with QT Pro using applescript. The strange thing is that on my Power Mac Dual G5 1.8 the export is fast (about 3 seconds for 20 s with sound). BUT the same process with the same script and files on my Xserve Dual G5 2.3 takes about 12 seconds - 4 times slower than the Power Mac! Activity Monitor shows a 10% CPU use

Any thoughts?

Al


----------



## jbwest (Nov 13, 2006)

I'm trying to diagnose the same question.

Why does the applescript 'export' as a script run alot slower than the same thing process done manually from the menu in QT pro? 

One clue is that the progress bar for each approach produces is a different type and size.
(Scripting uses a large box and manual export a smaller box).

I have a hunch that the two differ in the api they use to first extract and then export. While the QT7 has added new features and an new audio api, I'll bet they still have a lot of old stuff still incorportated.


----------

