ios - AVAssetWriterInput视频无法获取

标签 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];

我的输入图像缓冲图像,

但是生成的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/

相关文章:

iphone - 如何禁用 iOS 标签栏中的蓝色突出显示?

swift - AVQueuePlayer 当前项目已更改

ios - AVAssetResourceLoader 支持的 AVURLAsset 播放仅通过 AirPlay 失败

swift 。获取 CMAudioFormatDescription 时的 EXC_BREAKPOINT

ios - fatal error : Index out of range on second cell deletion

ios - UITableView 更新正确数量的 managedObjects,但不会显示值

python - 无法在 osx 中安装 bigfloat,命令 'clang' 失败,退出状态为 1

ios - 类的重构重命名导致终止

Xcode Bots 不会在成功/失败时发送电子邮件

ios - Xcode Scheme 中的调试可执行选项