I am trying to identify the different metadata items on a video on the iPad. So far I was able to successfully use the AVAsset libraries to find the file, and generate an array of AVMetadataItems using metadataForFormat:
. Only iTunes and Quicktime User data formats were found in the file. The issue is now that I have that information, I have no way of identifying what is what. I intended to load a dictionary with the information, indexed by the metadata key, but using the key
property of AVMetadataItem appears not to work correctly as if returns a number (debugger says its an NSCFNumber). Here is some sample code of what I am doing:
ALAssetRepresentation *representation = [[valAsset defaultRepresentation] retain];
NSURL *url = [representation url];
AVURLAsset *aAsset = [[AVURLAsset URLAssetWithURL:url options:nil] retain];
metaDataDict = [[NSMutableDictionary dictionary] retain];
NSArray *fmtmetadata = [aAsset metadataForFormat:@"com.apple.itunes"];
for (AVMetadataItem* meta in fmtmetadata)
{
[metaDataDict setObject:[meta stringValue]
forKey:[meta key]];
NSLog(@"metadata: key = %@", [meta key]);
}
This yields the following output in the debugger console:
metadata: key = -1452383891
metadata: key = -1452841618
metadata: key = 1684370275
metadata: key = 1818518899
metadata: key = 1937009003
metadata: key = -1453101708
Incidentally, changing the NSLog line to read:
NSLog(@"metadata: %@", meta);
gives us output like:
metadata: keySpace=itsk, key=desc, commonKey=(null), locale=(null), value=This is the Description of the Video, time={INVALID}, duration={INVALID}, extras={
dataType = 1;
}
Any help is greatly appreciated!
Looks like these keys are encoded ID3 tags:
1684370275 = 0x64657363 = {'d', 'e', 's', 'c'}
1818518899 = 0x6C646573 = {'l', 'd', 'e', 's'}
1937009003 = 0x7374696B = {'s', 't', 'i', 'k'}
etc.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With