how to get the frame rate of a Quicktime movie?

BNig niggemann at uni-wh.de
Tue Aug 28 10:44:29 EDT 2007


hi Josh,

i dont know what you need the framerate for but that is in my experience not
possible to extract from within Revolution, since all you get is the
duration and the timescale. This gives you the length in seconds of the
movie but not the framerate.

I get at the framerate by incorporating an applescript into the revolution
stack and query the movie in question through the Quicktime Player. The
applescript returns, if you wish so, the framerate.

One way to get at the framerate manually from within Revoltion is to 

make a player 
set the filename of the player
make shure the movie controls are visible and the alwaysbuffer is false
then e.g. make a button that returns the current time of the player and
displays it, in a field or so
then to the right of the movie controls click once, that advances the movie
one frame
then get the current time with your button and you get the duration of one
frame

I have not found a way in Revolution to do this kind of thing on videoclip.


to automate this the way I described obove here is an applescript to make
the point

tell application "QuickTime Player"
	tell document 1 -- make shure its a movie
		set theDuration to the duration
		set theTimeScale to the time scale
		tell track 1 -- make shure track 1 is a video track
			set theFrames to count of frames
			set theFrameLength to duration of frame 1
		end tell
	end tell
end tell

display dialog "length in seconds: " & theDuration / theTimeScale & return &
¬
	"framerate: " & theTimeScale / theFrameLength



you can easily adapt it so it returns the values to Revolution (if you want
i could adapt it for you)

Quicktime knows what the framerate of a movie is but it won't tell via
applescript directly

You are probably well aware that the time scale i.e. the fractions of a
second can vary from movie to movie, although you almost always find a time
scale of 600, but I know of programms that put out a time scale of 100 in
movies.
And I always find it a bit confusing that a duration of a frame lets say of
4 in a movie with a time scale of 100 translates to a framerate of 25/sec
(100/4), whereas a duration of a frame of 24 in a movie with a timescale of
600 (600/24)  also gives you a framerate of 25/sec.

Mind you, the last frame must not necessarily be a complete frame, so the
duration of the movie is not always an even multiple of the frame length.
(to scare even the bravest: you can set the duration of a frame via
applescript, so not all frames must be of the same duration, but for almost
all movies this is not the case) in Applescript you could of course get a
list of the duration of all the frames of the movie: set
theFrameDurationOfEveryFrame to the duration of every frame -> returns the
list

To sum it up: Quicktime apparently works on a frame basis, frames can have
very different lengths and Quicktime Player plays them as they are. If you
look at it from a frame perspective a framerate becomes a secondary measure
and may even change within a movie. 

I hope this helps

regards

Bernd




Josh Mellicker wrote:
> 
> 
> I found the following post from 2002:
> 
> 
>> Thanks Karl
>>
>> Here's what I have come up with so far.
>>
>> To determine the frame-rate of a video clip:
>>
>> It seems that if you advance the video clip from 0 by 1 frame (play  
>> step
>> forward) and divide the timescale property by the currenttime  
>> property, the
>> result is the video frame rate.
>>
>> Can anyone think of a better solution?
>>
>> Quicktime has both a timescale and a timebase property, but RR  
>> doesn't seem
>> able to access the timebase.
>> -- 
>> Robert Arnold
>> Associate Professor of Film
>> Boston University
>> Tel (617) 353-7735  Fax (617) 353-1084
>> http://people.bu.edu/rfarnold/
> 
> 
> I have tried "play step forward" in a myriad of forms.
> 
> Has anyone successfully used this command?
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-revolution
> 
> 

-- 
View this message in context: http://www.nabble.com/how-to-get-the-frame-rate-of-a-Quicktime-movie--tf4329806.html#a12369223
Sent from the Revolution - User mailing list archive at Nabble.com.




More information about the use-livecode mailing list