Quicktime Image Sequence help

Hi everyone,
I’m working on a research project where I need to turn A LOT of sets of .jpegs (100 per data set) into movies. As of now I have been using ‘Open Image Sequence’ option, which has been working quite well. The problem is that I may be having to take hundreds of data sets in the near future and doing this task by hand will become quite a chore. I was wondering if anyone knows if it would be possible to have AppleScript repeatedly make movies of these data sets, save them, label them, etc. Thanks in advance :smiley:

Model: Dual 2 GHz PowerPC G5
AppleScript: 2.1.1 or 1.10.6
Browser: Safari 417.9.2
Operating System: Mac OS X (10.4)

Here is a first little baby step of an example to get started


tell application "QuickTime Player" to open image sequence (choose file without invisibles)--I was working on a droplet or folder action but a crying 1 year old has halted my efforts.

How do you want to label them? Are the sequences organized in already labeled folders?

baby step two:

tell application "Finder" to set toSequence to (get first file of (choose folder) as alias)

tell application "QuickTime Player" to open image sequence toSequence

Making progress - a bare bones folder action:

on adding folder items to thisFolder after receiving droppedFolders
	repeat with thisFolder in droppedFolders
		
		tell application "Finder" to set toSequence to (get first file of thisFolder as alias)
		
		tell application "QuickTime Player" to open image sequence toSequence
		
	end repeat
end adding folder items to

I’ll keep fiddling until Dr Who comes on.

I have tried using

tell movie 1 to save self contained in...

and

close movie 1
	delay 2
	tell application "System Events" to tell window 1 of process "QuickTime Player"
		tell button "Save" of sheet 1
		click
		

to initiate saving without success so far. Oh well - I’ll go watch Dr Who.

How’s this?

Assuming that each sequence of images is stored in separate folders, and that the name of the first image can be used as the name of the movie, I scripted a folder action that works - at least in my small tests. The movie file will be saved in the same folder as the images. Without knowing more of what you want, this is the best I could do.

EDIT: I did a few more tests and it didn’t work as expected - it returns an error “AppleEvent timed out.” Because image size and export settings haven’t been considered yet, this is slow script. The first movie will be saved, but it doesn’t close, and the script stops. So that needs to be fixed, but at least this is a start.

on adding folder items to thisFolder after receiving droppedFolders
	repeat with thisFolder in droppedFolders
		
		tell application "Finder" to set theSequence to (get first file of thisFolder as alias)
		
		tell application "QuickTime Player"
			activate
			open image sequence theSequence
			
			set nameSequence to (theSequence as string) & ".mov"
			
			tell movie 1 to save self contained in nameSequence
			
			close movie 1
			
		end tell
		
	end repeat
end adding folder items to

This is untested, but I think I fixed it:


--Edited to fix a small error
on adding folder items to thisFolder after receiving droppedFolders
	repeat with thisFolder in droppedFolders
		
		tell application "Finder" to set theSequence to (get first file of thisFolder as alias)
		
		tell application "QuickTime Player"
			activate
			open image sequence theSequence
			
			set nameSequence to (theSequence as string) & ".mov"
			
			tell movie 1
				with timeout of 500 seconds
					save self contained in nameSequence
				end timeout
				
				close
				
			end tell
		end tell
		
	end repeat
end adding folder items to

EDIT:

I’m not sure if this is better or not, but

save self contained in nameSequence

could be replaced with

export to nameSequence as QuickTime movie using default settings with replacing

I don’t think I can improve it much more without more information about what you are doing.

Hi CapitalJ,

This looks exactly like what I’m looking for. I’m ocmpletely new to scripting, and need something like this for time-lapse photography: www.lobsterpictures.tv . I’ll try and get my knowledge of scripts past the ‘asking dumb questions’ stage and then maybe ask some clever ones. So far it’s: why doesn’t this just work when I double-click?

Love the references to small children and Doctor Who, btw, I work in an identical fashion.

I have be quick because my 12 month old is screaming - it isn’t clickable because it’s a folder action. Post back if you need help setting it up.

It could easily be rewritten as a clickable application, if you want.

Duty calls (deafeningly)

j

Hi J,
What I’d really like is for this to make a movie from the image sequence every time a new file turns up. Is this what it’s supposed to be doing?

thanks in advance,
Robbie

Hi Lobster (way off topic - would you believe I’ve lived most of my life within walking disance of the Massachusetts coast but I’ve never eaten lobster?)

The script was written to be attached to a single folder - let’s call it MovieMaker. To create a movie, drop a folder of images into MovieMaker and a movie with the name of the first image will be saved in the image folder. Not very fancy, but gets the job done.

For your purposes, do you mean

a) you’d have a folder of images, and every time an image is added a new movie would be made, or
b) an existing movie be updated to include the new image?

Would only one file be added at a time?

It can be done either way, and with more options, but describe the workflow so we can be sure that I understand what you want.

j

Hi J,

I’ve never had lobster myself - A lot of people that find my site because they’re looking for pictures of the darn things.

I’ll test your script as you’ve described it.

My workflow is this: I use digital stills cameras for shooting timelapse. This puts high-res files in a folder (lets call it RAW). Unfortunately the camera control programme also makes temp and thumbnail files, though these can be filtered. Also, the camera is in my studio at present so I don’t have it to hand.

What I want is a movie, small enough for web use, to be made, or better, updated, every time there’s a new shot taken and placed in the file. Then FTP’d to a website.

Additional things that would make this even better:
more info ftp’d to the site: how many frames, last frame taken
scaled-down stills in a photo-album format (I’ve found PHP that can do this, and made automator scripts for this)

Thanks in advance, Robbie

While I was waiting, I started working on rewriting the script to update create a movie that could be updated. I still have to look into export settings because that seems to be the appropriate way to do this.

Don’t know a thing about FTP yet. I’ve still very new to all of this - bought my very first computer less than a year ago (never even used them for work.) I also earned a BFA in photography 15 years ago which gathered dust while I a became glassblower (and everything went digital.) I’m on a steep learning curve.

Saw the site, by the way, nice.

Thanks J, and for the compliments on the site too. I’m currently erasing flies from each frame of a four-day rose-opening shot…

OK, so I opened your script in script editor, and saved it as a script. Then I attached it to a folder. So now I’m expecting, when I drop a folder full of sequential images in that folder, it should make a movie? it doesn’t What crucial step am I missing?

I have to saw for a computer newbie you’ve picked it up fast; I’ve been using macs for 11 years and not touched scripts. It’s all a foreign language to me.

Robbie

Hmm, I don’t know why it didn’t work for you -

I just save the posted version of my script, and tested it with a few quick screenshots. It saved the image sequence (the movie was supposed to close at the end, but it didn’t this time, maybe I need a delay somplace.)

Did a QuickTime window open at all? How many images were in the folder, and what format were they? Did you go into the advanced tab of QuickTime Preferences to set which image files it will open? (I don’t see RAW) Were you able to open and save the image sequence manually? I have to ask a lot of questions until I stumble on the correct one.

As written, my script is very basic, it might not be up to what you need it to do. I’ll keep tweaking.

j

OK, I saved as both a script, and as an app. Neither did anything, even opening QT.

Five images: 140_001.jpg to 140_005.jpg. JPEGs.

No problem manually opening as sequence, exporting, etc.

Robbie

It won’t work as an app - here is a quick (tested) rewrite that will. When it prompts to choose a file, navigate to your folder and choose the first image in the collection of sequential images.

tell application "Finder" to set theSequence to (choose file without invisibles)

tell application "QuickTime Player"
	activate
	open image sequence theSequence
	
	set nameSequence to (theSequence as string) & ".mov"
	
	tell movie 1
		with timeout of 500 seconds
			save self contained in nameSequence
		end timeout
		
		close
		
	end tell
end tell

You can also run it in Script Editor - click on “Event Log” at the bottom of the window to see what is happening.

And when you attached the previous script to a folder, what steps did you take to do that? Maybe something went wrong there.

OK, the app works great.

to add the action, my workflow was this:

saved script, as script.

right-clicked inside relevant folder, ‘add folder action’ - added saved script.

so was then expecting things to happen when I drop a folder into this, nothing did.

Off to bed. Many thanks for your help so far, J.

I’ll work a bit more - I’m 5 hours behind.

j