I have 300+ .mov-clips. I´m searching for a way to take snapshots, say 10 sec in each clip, saved as jpgs an a folder with the same name as the video.
Is this something for automator or do I need apples script?
/Pontus
I have 300+ .mov-clips. I´m searching for a way to take snapshots, say 10 sec in each clip, saved as jpgs an a folder with the same name as the video.
Is this something for automator or do I need apples script?
/Pontus
I think AppleScript
When you say “take snapshots, say 10 sec in each clip”.
Do you mean take a snapshot every 10 seconds in the movie clip or take a snapshot 10 seconds into the movie clip.
In either case I could do a script 4 you using iMagine Photo. Let me know what you need the script to do.
Kevin
If you do want me to do the script.
As well as answering the queries about what you were wanting, I will also need to know if for each movie clip does the frame rate remain constant?
Also do your movie clips have key frames with the other frames requiring all frames to be drawn from the last key frame for the frame to be rendered correctly. Or is every frame in your movie clip independent?
Kevin
I ment 10 seconds into the clip, but maby 1 second is better when I think about it. The framerate is 25 f/sec, but I have used 3 different ways of rendering the clips, quick time, after effects and compressor and I don´t remember if I used key frames in any of them. I would be really happy for a droplet that takes a snapshot of the very first frame too, but after a second would be better.
I chose a clip on random and here it take about 30 frames for the juggling to start, so maby frame 35 would be ideal.
http://www.juggling.se/video/7b_collect-start.mov
A few more:
http://www.juggling.se/video/5b_lift-forcebounce.mov
http://www.juggling.se/video/5c_66661_bc.mov
Here is a very short clip, only about 50 frames long:
http://www.juggling.se/video/3b_windmill_under.mov
Browser: Safari 412
Operating System: Mac OS X (10.4)
Moderator: Could you please movie this topic into the Mac OS X AppleScript forum as it will be more appropriate there for now.
Pontus, the following script does what you want for a single movie. You can change the movie time to whatever value you think is appropriate. When you run the script it will ask you for the movie file and for the folder where you want the snapshot to be saved. The file name of the snapshot will be the same as for the movie except the file extension will be changed to “jpeg”. The script expects the file name of your movie to have an extension.
To keep things simple, the script only deals with sync frames. For many movies every frame is a sync frame in that each frame is independent, but for some movies this is not the case, so the script will use the next sync frame after the requested time as the frame to use as the snapshot, if that is past the end of the movie then the script will ask for the sync frame immediately preceding the requested time.
The script requires iMagine Photo.
Kevin
property pMovieTime : 5.0 -- in seconds
on run
set moviefile to choose file with prompt "Choose a movie file to get frame from: "
set parentFolder to choose folder with prompt "Choose a folder where to save the movie snapshot"
my ProcessMovieFile(moviefile, parentFolder)
end run
on ProcessMovieFile(theFile, folderToPutImages)
tell application "iMagine Photo"
set thisMovie to import movie theFile
if the component error of thisMovie is not equal to 0 then
-- there was an error importing the movie, just return.
close thisMovie
return
end if
set theprops to the properties of thisMovie
set theFrame to my FindFrame(thisMovie, time scale of theprops, pMovieTime)
set {x, y, theWidth, theHeight} to the natural bounds of theprops
set thisDocument to make new graphic document with properties {dimensions:{theWidth, theHeight}}
set the drawing destination of thisMovie to thisDocument
set the current time of thisMovie to theFrame
draw thisMovie
set the export folder location of thisDocument to folderToPutImages
set theName to the file name of thisMovie
-- default export type of a graphic document is jpeg, therefore don't need to specify it.
set theName to my ChangeFileExtension(theName, "jpeg")
set the export file name of thisDocument to theName
export thisDocument
close thisDocument
close thisMovie
end tell
end ProcessMovieFile
on ChangeFileExtension(fileName, newExtension)
set AppleScript's text item delimiters to "."
set theStrings to the text items of fileName
set newString to items 1 thru -2 of theStrings & newExtension as string
return newString
end ChangeFileExtension
on FindFrame(theMovie, timeScale, movieTime)
tell application "iMagine Photo"
set timeScaleTime to movieTime * timeScale as integer
set current time of theMovie to timeScaleTime
set syncSample to the next sync sample of theMovie
if syncSample is equal to -1 then
-- after the last frame
set current time of theMovie to timeScaleTime
set syncSample to the previous sync sample of theMovie
end if
end tell
return syncSample
end FindFrame
Thats supersweet!
Never heard about iMagine Photo, but it workes great.
Is it difficult making it into a droplet where it askes once for a folder to save in?
/Pontus
When I get a chance I’ll do you a droplet. Hopefully in the next day or 2 unless somebody else beats me to it. I’m always a bit strapped for time.
Kevin
:lol: no hurry!
Pontus,
Could you please checkout the file:
http://www.yvs.eu.com/downloads2/TakeMovieSnapshot.zip
To configure, double click on the script. To use drop your movies onto the script.
Let me know if you have problems with it. I might post the script it to scriptbuilders if it proves to work.
Kevin
It works great! Exactly how I whanted it.
But I think you should put a Read Me telling people to double-click the droplet befor use. I hade to open the script to figure that out. Or maby even better that the script askes once every time you drop clips on it where to save it and what second to use.
I haven´t tried yet to set a time too big for a clip and I haven´t tested other formats, but a big thanks!