无论选择哪种AVVideoWidthKey
,AVVideoHeightKey
,AVVideoCleanApertureWidthKey
,AVVideoCleanApertureHeightKey
,我的视频分辨率看起来都是320x240或480x360。
我正在尝试将视频保存为480p,我的所有缓冲区均为640x480,我的 session 位于AVCaptureSessionPreset640x480
,所有内容均为640x480,但我的输出视频仍然按比例缩小。
我使用的是AVAssetWriterInputPixelBufferAdaptor
,传递给它的CMSampleBufferRef
是640x480。
我到处都在查看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];
关于ios - AVAssetWriterInput,无法选择视频分辨率吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8394935/