AVAssetWriterInput,无法选择video分辨率?
看起来无论我选择AVVideoWidthKey
, AVVideoHeightKey
, AVVideoCleanApertureWidthKey
, AVVideoCleanApertureHeightKey
,我的video分辨率都是320×240或480×360。
我正在尝试以480p保存video,所有缓冲区都是640×480,我的会话是AVCaptureSessionPreset640x480
,一切都是640×480,但我的输出video仍然按比例缩小。
我正在使用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], AVVideoHeightKey, self.compressionProperties, AVVideoCompressionPropertiesKey, nil] autorelease]; ... wobj.writerInput = [[[AVAssetWriterInput alloc] initWithMediaType:AVMediaTypeVideo outputSettings:self.videoSettings] autorelease];