2012-12-10 26 views
2

我使用AVAssetWriter生成圖像的視頻,我的作家設置AVAssetWriterInput視頻拿不到

NSDictionary* videoSettings = [NSDictionary dictionaryWithObjectsAndKeys: 
           AVVideoCodecH264, AVVideoCodecKey, 
           [NSNumber numberWithInt:self.frame.size.width], AVVideoWidthKey, 
           [NSNumber numberWithInt:self.frame.size.height], AVVideoHeightKey, 
           videoCompressionProps, AVVideoCompressionPropertiesKey, 
           nil]; 
videoWriterInput = [[AVAssetWriterInput assetWriterInputWithMediaType:AVMediaTypeVideo outputSettings:videoSettings] retain]; 

我輸入圖像緩衝區圖像,

enter image description here

但產生的MOV文件看起來像這樣

enter image description here

回答

0

我使用AVAssetWriter生成影像,使用我剛剛修改過的作者設置。

NSDictionary* videoSettings = [NSDictionary dictionaryWithObjectsAndKeys: 
           AVVideoCodecH264, AVVideoCodecKey, 
           [NSNumber numberWithInt:imageView.size.width], AVVideoWidthKey, 
           [NSNumber numberWithInt:imageView.size.height], AVVideoHeightKey, 
           videoCompressionProps, AVVideoCompressionPropertiesKey, 
           nil]; 
videoWriterInput = [[AVAssetWriterInput assetWriterInputWithMediaType:AVMediaTypeVideo outputSettings:videoSettings] retain];