AVAssetWriterInput视频无法获取

时间:2012-12-10 05:56:22

标签: ios xcode avfoundation avassetwriter

我使用AVAssetWriter,我的作家设置

生成图像到视频
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

1 个答案:

答案 0 :(得分: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];
相关问题