Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

How to find the frames-per-second of a Quicktime movie using Applescript?

Is there a way to find out the real-time "frames per second" of a Quicktime movie?

The only Applescript movie properties in Quicktime which I have found to be useful are "duration" and "time scale". The real-time duration of the movie in seconds is found by dividing "duration" by "time scale".

But "time scale" only sometimes relates to any real time property. In some cases it does (2500 = PAL 25 fps, 2997 = NTSC 29.97 fps) but for many other movie types I've opened (DivX, flv, mp4 etc) the "time scale" is often reported as "600" even though the Quicktime movie inspector window will report a frame rate of 25, 29.97, 15 or some other number.

Where does the Quicktime movie inspector window extract the FPS from, and is it possible to extract that same number, or calculate the real-time FPS of a Quicktime movie using Applescript only?

Thanks.

G5 Desktop PPC 1.6 GHz, Mac OS X (10.4.11)

Posted on Dec 13, 2008 3:47 PM

Reply
3 replies

Dec 18, 2008 2:09 PM in response to Brendan Jones

tell application "QuickTime Player"
tell document 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
This will allow you to see the current Frames/second. (The number will appear on the Script Editor results)
Or you could do: display dialog "" & FPS & ""

Dec 20, 2008 2:23 AM in response to Ed Kraus

Thanks for this but unfortunately it only works for some movie types. For .dv .flv and .divx movies, this script correctly calculates the FPS. But for .mpg .mp4 and .m4v it does not.

For .mpg movies I tested, the count of frames was always 1, so clearly the FPS calculation is always wrong.

For the .mp4 and .m4v movies I tried, the FPS was always reported as 43, regardless of whether the actual FPS was 25 or 29.97. In all cases the count of frames was incorrect.

A bug in Quicktime?

Dec 20, 2008 11:10 AM in response to Brendan Jones

erm maybe.... try this:
set the_movie to choose file -- choose a qt movie
tell application "QuickTime Player"
launch
activate
open the_movie
tell front document
stop
rewind
set vid_track to (first track whose type is "vide")
end tell
set frame_count to (count frames of vid_track)
end tell

A Movie inspector dialog should appear, and then you can see the Playing FPS.

How to find the frames-per-second of a Quicktime movie using Applescript?

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.