AVUrlAsset全分辨率问题

时间:2012-06-15 08:10:00

标签: ios resolution movie avurlasset

我有一个奇怪的(对我来说)问题。我用我的iphone 3gs记录了两个.mov文件。当我在mac上打开它们时,它们是640x480。当我在我的应用程序中打开时,标准调用AVURLAsset,AVAssetReader等等......我仍然得到480x360。

你们有人可以帮助(澄清)吗?这是正常的吗?当我从相机捕获时,我可以在640x480下运行,即CMSampleBuffer具有正确的宽度和高度,因此我创建的UIImage更远。

AVURLAsset* asset;
NSString* fileBundle;
NSURL* url;
NSError* error;
NSArray* videoTracks;
AVAssetTrack* track;
NSMutableDictionary* dictionary;

fileBundle = [[NSBundle mainBundle] pathForResource:@"TestMovies/movie1" ofType:@"mov"];
url = [NSURL fileURLWithPath:fileBundle];

asset = [[AVURLAsset alloc] initWithURL:url options:nil];
movieAsset = [[AVAssetReader alloc] initWithAsset:asset error:&error];
videoTracks = [asset tracksWithMediaType:AVMediaTypeVideo];
track = [videoTracks objectAtIndex:0];
dictionary = [[NSMutableDictionary alloc] init];
[dictionary setObject:[NSNumber numberWithInt:kCVPixelFormatType_32BGRA] forKey:(id)kCVPixelBufferPixelFormatTypeKey];
movieOutput = [[AVAssetReaderTrackOutput alloc] initWithTrack:track outputSettings:dictionary];
[movieAsset addOutput:movieOutput];
[movieAsset startReading];

然后,在一个定时成员:

if( [movieAsset status] == AVAssetReaderStatusReading ) {
    CMSampleBufferRef buf;
    UIImage* img = [[UIImage alloc] initWithCMSampleBufferRef:buf];

显然,UIImage的扩展包含在项目中......

0 个答案:

没有答案