I need to get the same kind of info that you can get on <strong>"Get Info"</strong> when using Finder; more specifically I need the same info that is present in the "More Info" section, like Duration, Bitrate, Dimension, Codecs, Audio channels, etc.
To get the basic info like size, type, I have:
// Getting the file's attributes NSError *error; NSFileManager *fm = [NSFileManager defaultManager]; NSDictionary *fileInfo = [fm attributesOfItemAtPath:fileName error:&error];
Is there any native Cocoa library to get this info?Answer1:
I need to get the same kind of info that you can get on "get info" when using Finder, more specifically I need the same info that is present on "more info" section, like Duration, Bitrate, Dimension, Codecs, Audio channels, etc.</blockquote>
Do it the same way the Finder does: <a href="http://developer.apple.com/mac/library/documentation/Carbon/Reference/SpotlightReference_Collection/" rel="nofollow">Spotlight</a>. (Don't let the word “Carbon” in the path scare you off: It's part of Core Services, so it is available in 64-bit.) Just instantiate an MDItem for the file you're interested in.
Another way would be to use Foundation's own wrapper of that framework (which is included on that page), but then you need to do an NSMetadataQuery that searches for items whose
kMDItemPath is the path to the file you're interested in. A lot of needless hassle—using MDItem directly will get you there faster.
A nice bonus is that this works for more than just video and audio files. Image files also have metadata that Finder and your app can show.Answer2:
QTMovie instance, and then query its properties with a