我正在尝试使用AVAssetWriter将CGImages写入文件以从图像创建视频.
我已经在模拟器上以三种不同的方式成功地工作了,但是在运行iOS 4.3的iPhone 4上,每种方法都失败了.
这一切都与像素缓冲区有关.
我的第一种方法是在不使用池的情况下根据需要创建像素缓冲区.这可行,但在内存密集,无法在设备上工作.
我的第二种方法是使用推荐的AVAssetWriterInputPixelBufferAdaptor,然后使用CVPixelBufferPoolCreatePixelBuffer从适配器pixelBufferPool中拉出像素缓冲区.
这也适用于模拟器,但在设备上失败,因为永远不会分配适配器的像素缓冲池.我没有收到任何错误消息.
最后,我尝试使用CVPixelBufferPoolCreate创建自己的像素缓冲池.这也适用于模拟器,但在设备上,一切正常,直到我尝试使用appendPixelBuffer追加像素缓冲区,每次都失败.
我在网上找到了非常少的信息.我的代码基于我发现的例子,但现在几天都没有运气.如果ANYONE有成功使用AVAssetWriter的经验,请查看并告诉我您是否看到任何不合适的地方.
注意:您将看到注释掉的尝试块.
首先,设置
- (BOOL) openVideoFile: (NSString *) path withSize:(CGSize)imageSize {
size = CGSizeMake (480.0, 320.0);//imageSize;
NSError *error = nil;
videoWriter = [[AVAssetWriter alloc] initWithURL:
[NSURL fileURLWithPath:path] fileType:AVFileTypeQuickTimeMovie
error:&error];
if (error != nil)
return NO;
NSDictionary *videoCleanApertureSettings = [NSDictionary dictionaryWithObjectsAndKeys:
[NSNumber numberWithDouble:size.width], AVVideoCleanApertureWidthKey,
[NSNumber numberWithDouble:size.height], AVVideoCleanApertureHeightKey,
[NSNumber numberWithInt:10], AVVideoCleanApertureHorizontalOffsetKey,
[NSNumber numberWithInt:10], AVVideoCleanApertureVerticalOffsetKey,
nil];
NSDictionary *videoAspectRatioSettings = [NSDictionary dictionaryWithObjectsAndKeys:
[NSNumber numberWithInt:1], AVVideoPixelAspectRatioHorizontalSpacingKey,
[NSNumber numberWithInt:1],AVVideoPixelAspectRatioVerticalSpacingKey,
nil];
NSDictionary *codecSettings = [NSDictionary dictionaryWithObjectsAndKeys:
//[NSNumber numberWithInt:960000], …Run Code Online (Sandbox Code Playgroud) 我们的应用程序刚刚发布了一个重大更新,我们有一个持续获取此警报的用户:
标题:连接到iTunes以使用推送通知
消息:通知可能包括警报,声音和图标徽章.
用户点击确定,它只是弹回,不允许用户使用该应用程序.用户已连接到iTunes并正在接收来自其他第三方应用程序的通知.用户已多次重新启动,卸载并从应用商店重新安装应用程序几次.
iPhone 5运行6.0.1
谷歌搜索结果表明这是越狱设备的问题,但这个用户不是.
有没有其他人遇到过这个问题?