Wednesday, November 22, 2017

#1 2005-05-25 09:45:55 am

pontusuggla
Member
Registered: 2004-11-04
Posts: 29

Snapshots in QT

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

Offline

 

#2 2005-05-25 10:46:31 am

ktam
Member
From:: UK
Registered: 2003-01-24
Posts: 246
Website

Re: Snapshots in QT

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


MovingImages is a scripting tool for non-linear video editing.
http://zukini.eu/movingimages

iMagine Photo is deprecated. I would not use it for any new projects.

Offline

 

#3 2005-05-25 02:24:14 pm

ktam
Member
From:: UK
Registered: 2003-01-24
Posts: 246
Website

Re: Snapshots in QT

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


MovingImages is a scripting tool for non-linear video editing.
http://zukini.eu/movingimages

iMagine Photo is deprecated. I would not use it for any new projects.

Offline

 

#4 2005-06-04 01:41:36 pm

pontusuggla
Member
Registered: 2004-11-04
Posts: 29

Re: Snapshots in QT

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)

Offline

 

#5 2005-06-06 03:22:24 am

ktam
Member
From:: UK
Registered: 2003-01-24
Posts: 246
Website

Re: Snapshots in QT

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

Applescript:


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


MovingImages is a scripting tool for non-linear video editing.
http://zukini.eu/movingimages

iMagine Photo is deprecated. I would not use it for any new projects.


Filed under: iMagine

Offline

 

#6 2005-06-06 06:22:42 am

pontusuggla
Member
Registered: 2004-11-04
Posts: 29

Re: Snapshots in QT

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

Offline

 

#7 2005-06-06 06:28:47 am

ktam
Member
From:: UK
Registered: 2003-01-24
Posts: 246
Website

Re: Snapshots in QT

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


MovingImages is a scripting tool for non-linear video editing.
http://zukini.eu/movingimages

iMagine Photo is deprecated. I would not use it for any new projects.

Offline

 

#8 2005-06-06 06:31:54 am

pontusuggla
Member
Registered: 2004-11-04
Posts: 29

Re: Snapshots in QT

lol no hurry!

Offline

 

#9 2005-06-06 07:36:42 am

ktam
Member
From:: UK
Registered: 2003-01-24
Posts: 246
Website

Re: Snapshots in QT

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


MovingImages is a scripting tool for non-linear video editing.
http://zukini.eu/movingimages

iMagine Photo is deprecated. I would not use it for any new projects.

Offline

 

#10 2005-06-06 08:56:38 am

pontusuggla
Member
Registered: 2004-11-04
Posts: 29

Re: Snapshots in QT

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!

Offline

 

Board footer

Powered by FluxBB

RSS (new topics) RSS (active topics)