gpt4 book ai didi

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

转载 作者:行者123 更新时间:2023-12-01 17:45:10 29 4
gpt4 key购买 nike

无论选择哪种AVVideoWidthKeyAVVideoHeightKeyAVVideoCleanApertureWidthKeyAVVideoCleanApertureHeightKey,我的视频分辨率看起来都是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/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com