如何获取时间码开始和QT电影的持续时间?我已经发现我必须使用QTKIt和QTStringFromSMPTETime,但我在网上找不到任何例子。
答案 0 :(得分:0)
以下是使用QTKit和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
}
}