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

前端之家收集整理的这篇文章主要介绍了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];

猜你在找的iOS相关文章