• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag
 

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Quicktime frame rate calculation error
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Quicktime frame rate calculation error


  • Subject: Re: Quicktime frame rate calculation error
  • From: Shane Stanley <email@hidden>
  • Date: Sat, 13 Dec 2014 09:54:40 +1100

On 13 Dec 2014, at 5:14 am, Jim Weisbin <email@hidden> wrote:

Here is how I calculate the frame rate:

set the_video_track to (the first track of document 1 whose type is "vide")

tell document 1
set totalduration to duration of the_video_track

set NumberOfFrames to count frames of the_video_track
set timeScaleOfMovie to the time scale

end tell
set my_duration to (totalduration / timeScaleOfMovie)
set FPS to NumberOfFrames / my_duration

For most movies this works. But for AVC encoded movies, “count frames” yields the result “1”

Any idea why?

No, and I don't know much about video. But I have a video file here that VLC tells me is H264 - MPG-4 AVC (avc1). And when I run this:

use AppleScript version "2.3.1"
use scripting additions
use framework "Foundation"
use framework "AVFoundation"

set anNSURL to current application's |NSURL|'s fileURLWithPath:"/path/to/video"
set theAsset to current application's AVURLAsset's URLAssetWithURL:anNSURL options:(missing value)
set theTrack to (theAsset's tracksWithMediaType:(current application's AVMediaTypeVideo))'s objectAtIndex:0
set theFrameRate to theTrack's nominalFrameRate()
set theSize to theTrack's naturalSize()
return {theFrameRate, width of theSize, height of theSize}


I get:

--> {29.969722747803, 946.065490722656, 512.0}

-- 
Shane Stanley <email@hidden>
<www.macosxautomation.com/applescript/apps/>

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users

This email sent to email@hidden

References: 
 >Quicktime frame rate calculation error (From: Jim Weisbin <email@hidden>)

  • Prev by Date: Quicktime frame rate calculation error
  • Next by Date: Requesting assistance with 'Mail' app
  • Previous by thread: Quicktime frame rate calculation error
  • Next by thread: Re: Quicktime frame rate calculation error
  • Index(es):
    • Date
    • Thread