Reputation: 1000
I have a quicktime object i am reading with av foundation. I can see it's tracks and I would like to be able to read the 'tmcd' track (timecode) and get it's output as a string i can use in an NSTextView.
With an NSLog and a [track formatDescriptions] i see:
{\n\tmediaType:'tmcd' \n\tmediaSubType:'tmcd' \n\tmediaSpecific: {\n\t\tframeDuration: {1001/24000 = 0.042}\t\tframes/sec: 24\t\ttcFlags: 0 \n\t} \n\textensions: {{type = immutable dict, count = 1,\nentries =>\n\t1 : {contents = \"VerbatimSampleDescription\"} = {length = 38, capacity = 38, bytes = 0x00000026746d63640000000000000001 ... 03e918d400000000}\n}\n}\n}" )
I can can see there is a lot of information in there, but I wonder how I can use this. Is this something I can pull apart with other AV Foundation tools or do I need to break it apart somehow?
Basically I would like to end up with a format such as "00:12:23:12"
Thanks!
Adam
Upvotes: 0
Views: 1115
Reputation: 381
Try using avfprobe. It will decode all of the track info for you, including the CMFormatDescription
that you mentioned in your question. You'll see something like this:
formatDescriptions = [
{
mediaType = kCMMediaType_TimeCode; // = 'tmcd'
mediaSubType = 'tmcd';
extensions = {
VerbatimSampleDescription = <00000022 746d6364 00000000 00000001 00000000 00000002 0000ea60 000003e9 3c00>;
};
},
];
However, this is just info about the timecode track -- not the contents of the track. I also don't have any more information about the contents of the VerbatimSampleDescription
property.
Upvotes: 1
Reputation: 588
You could try this:
NSArray* arrFormat = [tTrack formatDescriptions];
NSInteger nCountArr = [arrFormat count];
CMTimeCodeFormatDescriptionRef refCmFormat = (__bridge CMTimeCodeFormatDescriptionRef)(arrFormat[0]);
NSDictionary* dictFormat = (__bridge NSDictionary *)(refCmFormat);
NSLog(@"format[%ld] = %@", nCountArr, dictFormat);
In dictFormat you get keys and values for your not well readable formatDescriptions string abobe. Then have a look, what keys/values you need...
Upvotes: 0