ios – AVAssetWriterInput,无法选择视频分辨率?

看起来无论我选择AVVideoWidthKey,AVVideoHeightKey,AVVideoCleanApertureWidthKey,AVVideoCleanApertureHeightKey,我的视频分辨率都是320×240或480×360.

我正在尝试以480p保存视频,所有缓冲区都是640×480,我的会话是AVCaptureSessionPreset640x480,一切都是640×480,但我的输出视频仍然按比例缩小.

我正在使用AVAssetWriterInputPixelBufferAdaptor和我传递给它的CMSampleBufferRef,它是640×480.

我已经查看了Stack Overflow,但我还没有发现这个问题. :/

解决方法

我一直使用这个设置,它的工作原理.这是一个代码示例.
self.compressionProperties = [[[NSMutableDictionary alloc] initWithObjectsAndKeys:
                               [NSNumber numberWithInt:params.bps],AVVideoAverageBitRateKey,[NSNumber numberWithInt:params.keyFrameInterval],AVVideoMaxKeyFrameIntervalKey,//videoCleanApertureSettings,AVVideoCleanApertureKey,params.videoProfileLevel,AVVideoProfileLevelKey,nil ] autorelease];

self.videoSettings = [[[NSMutableDictionary alloc] initWithObjectsAndKeys:AVVideoCodecH264,AVVideoCodecKey,[NSNumber numberWithInt:params.outWidth],AVVideoWidthKey,[NSNumber numberWithInt:params.outHeight],self.compressionProperties,AVVideoCompressionPropertiesKey,nil] autorelease];

...

wobj.writerInput = [[[AVAssetWriterInput alloc] initWithMediaType:AVMediaTypeVideo outputSettings:self.videoSettings] autorelease];

相关文章

UITabBarController 是 iOS 中用于管理和显示选项卡界面的一...
UITableView的重用机制避免了频繁创建和销毁单元格的开销,使...
Objective-C中,类的实例变量(instance variables)和属性(...
从内存管理的角度来看,block可以作为方法的传入参数是因为b...
WKWebView 是 iOS 开发中用于显示网页内容的组件,它是在 iO...
OC中常用的多线程编程技术: 1. NSThread NSThread是Objecti...