How do I get th开发者_运维百科e timecode start and the duration of a QT movie? I've figured out that I have to use QTKIt and maybe QTStringFromSMPTETime but I couldn't find any example on the web.
Here is an example using QTKit and the QuickTime API:
QTTrack * tcTrack = [[self.movie tracksOfMediaType:QTMediaTypeTimeCode] objectAtIndex:0];
if (tcTrack != nil) {
QTMedia * media = [tcTrack media];
if (media != nil) {
NSLog(@"sample : %@", [media attributeForKey:QTMediaSampleCountAttribute]);
Media qtMedia = [media quickTimeMedia];
MediaHandler mh = GetMediaHandler(qtMedia);
long frameNum;
TimeCodeDef tcDef;
TimeCodeRecord tcData;
UserData srcRefH;
TCGetTimeCodeAtTime(mh, 0, &frameNum, &tcDef, &tcData, &srcRefH);
// frameNum holds the frame number since 00:00:00:00
// tcData holds the HH:MM:SS:FF data
}
}
精彩评论