Skip to content

Instantly share code, notes, and snippets.

@jstn
Last active December 16, 2015 14:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save jstn/5451843 to your computer and use it in GitHub Desktop.
Save jstn/5451843 to your computer and use it in GitHub Desktop.
frame rate of a QTMovie
- (NSTimeInterval)frameRateForMovie:(QTMovie *)movie
{
for (QTTrack *track in [movie tracks]) {
QTMedia *media = [track media];
if (![media hasCharacteristic:QTMediaCharacteristicHasVideoFrameRate])
continue;
QTTime duration = [(NSValue *)[media attributeForKey:QTMediaDurationAttribute] QTTimeValue];
long sampleCount = [(NSNumber *)[media attributeForKey:QTMediaSampleCountAttribute] longValue];
return sampleCount * ((NSTimeInterval)duration.timeScale / (NSTimeInterval)duration.timeValue);
}
return 0.0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment