In the finder, I have a lot of QuickTime file (about 5000) that are not self-contained. And I simply need to make them self-contained.
The manual way (with QuicktimePro) is open them, one by one, and then :
Save as…
Don’t change the file name !
verify that :)make self contained is checked
Validate…
“Replace”, Because yes, I’m ok (and I want) to write over (replace) the original one !
close the windows
And I have to do that about 5000 times !!!
So… I’ve found in ScriptEditor a command in QuickTime Player library : “save self contained” But I don’t know how to use it (I’m not a ScriptEditor devellopper… I don’t know the syntax… I only know Automator) ! I’ve planed to make just a small script with this simple command, and then use (tell) this small script in Automator.
What do you thinks about all of that ? I suppose that for you, it’s very simple… but for me, it’s terrrrible !
You could adapt it to move the newly saved movies to a separate folder or however it would suit you.
on adding folder items to thisFolder after receiving added_Items
tell application "QuickTime Player"
repeat with theFile in added_Items
open theFile
set NewFile to text 1 thru -5 of (theFile as string) & "_sc.mov"--I added "sc" to mark it as the self contained movie
tell front movie
stop
with timeout of 500 seconds
save self contained in NewFile
end timeout
close
end tell
end repeat
end tell
end adding folder items to
Thanks a lot !!! I’ll try to understand this new language !..
About what I’ve read, I don’t need to make a new file with “_sc” at the end : I just need to replace the original one by the self contained… If possible without the question “It already exists. Do you want to replace the original ?”…
Do you know what I meen ?
One more thing : Can I use this script in Automator ? Or is this script made to be use standalone ?
Before I go any further, test this and post back. My wife is about to catch me shirking my checkbook duties. You can just run it in Script Editor.
tell application "QuickTime Player"
set theFile to (choose file)
open theFile
set NewFile to text 1 thru -5 of (theFile as string) & ".mov"
tell front movie
stop
with timeout of 500 seconds
export to NewFile as QuickTime movie using default settings with replacing
end timeout
close
end tell
end tell
There is room for improvement, but here is what I have. You should be able to adapt one of thes to your needs.
Script for Automator:
--Replace (* Your script goes here *) with this:
tell application "QuickTime Player"
repeat with theFile in input
open theFile
set NewFile to text 1 thru -5 of (theFile as string) & ".mov"
tell front movie
stop
with timeout of 500 seconds
export to NewFile as QuickTime movie using default settings with replacing
end timeout
close
end tell
end repeat
end tell
As a droplet:
--Prompt to choose a movie if double clicked:
on run
tell application "QuickTime Player"
set theFile to (choose file without invisibles)
open theFile
set NewFile to text 1 thru -5 of (theFile as string) & ".mov"
tell front movie
stop
with timeout of 500 seconds
export to NewFile as QuickTime movie using default settings with replacing
end timeout
close
end tell
end tell
end run
--Convert files dropped on application icon:
on open theItems
tell application "QuickTime Player"
repeat with theFile in theItems
open theFile
set NewFile to text 1 thru -5 of (theFile as string) & ".mov"
tell front movie
stop
with timeout of 500 seconds
export to NewFile as QuickTime movie using default settings with replacing
end timeout
close
end tell
end repeat
end tell
end open
As a folder action:
on adding folder items to thisFolder after receiving added_Items
tell application "QuickTime Player"
repeat with theFile in added_Items
open theFile
set NewFile to text 1 thru -5 of (theFile as string) & ".mov"
tell front movie
stop
with timeout of 500 seconds
export to NewFile as QuickTime movie using default settings with replacing
end timeout
close
end tell
end repeat
end tell
end adding folder items to
I prefer to use save self contained because I don’t want that it recompress the file ; I just want it make self contained.
I also prefer that newfile is the same as original file, because sometimes, originak extension is not always .mov. It could be .aiff or .mp4… or…
So : What I really need is based on that :
...
set NewFile to text of (theFile as string)
...
save self contained in NewFile with replacing
...
But it occurs a bug : the file become very very big, and QuickTime take a very very long time time accept to quit.
Do you have any idea about this strange bug ? (I’ve tryed this with differents files… The bug always occurs)
So the extension needs to be a variable. That shouldn’t be too hard. I picked “.mov” arbitrarily for something to work with, and although I didn’t like the recompression, etc., I switched to
export to NewFile as QuickTime movie using default settings with replacing
because I was having trouble with
set NewFile to text of (theFile as string)
save self contained in NewFile with replacing
and I think one problem is that
set NewFile to text of (theFile as string)
is lacking an extension.
As I understand it, the newly saved movie should be larger because it is no longer a hinted movie. I don’t know of a way around that other than using custom export settings if exporting- I’m not sure about saving self contained. What happened when you tried my original script? Did it result in a much larger file? I only created tiny clips for quick experimentation.
If overwriting the hinted movie doesn’t work (I’ll go back and ty again, but…) what about going back to my original suggestion of “…sc.mov”. If file type of the original is set as a variable - theExt - it would be “…sc.” & theExt - and then the original could be moved to the trash.
Um, other than working in the middle of the night, I don’t know what I did wrong before, but this seems to work now - it overwrites the original. Does it work for you? (The original tested was a .mov) I haven’t dealt with the extensions yet. I’ll try to work on that soon
on adding folder items to thisFolder after receiving added_Items
tell application "QuickTime Player"
repeat with theFile in added_Items
open theFile
set NewFile to text 1 thru -5 of (theFile as string) & ".mov"
tell front movie
stop
with timeout of 500 seconds
save self contained in NewFile
end timeout
close
end tell
end repeat
end tell
end adding folder items to
EDIT: I think the timeout might be unnecessary - I ran the script without it and it still worked.
on adding folder items to thisFolder after receiving added_Items
tell application "QuickTime Player"
repeat with theFile in added_Items
open theFile
set theExt to (name extension of (info for theFile))
set theExt to "." & theExt
set NewFile to text 1 thru -5 of (theFile as string) & theExt
tell front movie
stop
with timeout of 500 seconds
save self contained in NewFile
end timeout
close
end tell
end repeat
end tell
end adding folder items to
Your welcome, glad to help - hope it withstands a real world test.
I found the timeout bit in another post, before I realized it might not be necessary for save self contained. The timeout was left in after I took out “export to newFile…” which does need it.
When exporting, the process is slow, and the timeout gives the script enough time to finish that step before moving on. Otherwise, the current movie will finish saving, but the script will have stopped and returned the error “AppleEvent Timed Out.” I don’t know how long “saving self contained” might last - I never did it before.