我使用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];
我的输入图像缓冲图像,
但是生成的mov文件看起来像这样
最佳答案
我使用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];
关于ios - AVAssetWriterInput视频无法获取,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13795759/