Last active
December 16, 2015 14:49
-
-
Save jstn/5451843 to your computer and use it in GitHub Desktop.
frame rate of a QTMovie
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (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