QuickTime Frame Rate

I think I have a simple question…

I’d like to use AppleScript to get the frame rate of a QuickTime Movie (FPS).

I have 1000’s of QT movies that I need to export as jpg files. Some of the sources movies are ~15 fps and some are ~7.5 fps.

So I need a script that will look at the FPS and then choose the correct export settings.

This is my current code for figuring out the FPS:

set durationOfFrame to the duration of frame 1 of track 1 of movie 1
set timeScaleOfMovie to the time scale of movie 1
set FPS to timeScaleOfMovie / durationOfFrame

The problem is that this code doesn’t return the same number that I get when I “Get info” in the QT player.
For example if I run this code on movie that QT player reports a fps of 14.5, I get 13.95?


Hi Robert,

try this formula:

tell application "QuickTime Player"
	tell movie 1
		set totalduration to duration
		set NumberOfFrames to (count frames of track 1)
		set timeScaleOfMovie to the time scale
	end tell
	set FPS to round NumberOfFrames / (totalduration / timeScaleOfMovie)
end tell

That was it! Thank You.


Interesting. Looks like rate and preferred rate return values between 0.0 and 1.0. A scale, not an actual frame rate value.

Can’t say I’m super-thrilled about that decision. I suppose I can see how it’s used, and how it fits with other APIs, but meh.