I’m writing a script that reads a quicktime file and reports the frame rate. For most videos it works fine. For others, the script sees the frame rate having too many decimal places. This throws off some of my future calculations. For example, if a video reports a frame rate of : 59.947414548642
The TRUE rate should be 59.94
If I try rounding to the nearest hundredth, I get 59.95
Although this is close, it throws off my future calculations. I would like my script to return the value as 59.94
Here is my script. It normally selects a quicktime file in the beginning, but I simplified it for you and inserted the values instead.
Can anyone help me return a value of 59.94???
--set theFile to (choose file)
--tell application "QuickTime Player"
-- open (launch)
-- open theFile
-- tell document 1
-- tell (1st track whose kind is "Video")
set frameCount to 228 --count frames
-- end tell
set time_scale to 600 --time scale
set totalduration to 2282 --duration
set frameRate to (frameCount * time_scale) / totalduration
-- end tell
-- quit
--end tell
display dialog frameRate as string