私は奇妙な(私にとって)問題を抱えています。iPhone 3gs で 2 つの .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 への拡張機能はプロジェクトに含まれています...