hpique
hpique

Reputation: 120324

Get original size of video with Objective-C in OS X

What's the simplest way to get the original size (width & height) of a video with Objective-C in Mac OS X 10.7?

Upvotes: 1

Views: 321

Answers (1)

walkytalky
walkytalky

Reputation: 9543

Assuming the movie is something readable by QuickTime -- and if it isn't you're probably out of luck anyway -- something like this should do the trick, I think:

QTMovie* movie = [QTMovie movieWithFile:movieFileName error:nil];
NSSize size = [(NSValue*)[movie attributeForKey:QTMovieNaturalSizeAttribute] sizeValue];

(NB: untested, no error checking, etc.)

Upvotes: 2

Related Questions