gpt4 book ai didi

ios - AVAssetWriter 如何创建无压缩的 mov 视频?

转载 作者:塔克拉玛干 更新时间:2023-11-02 07:50:33 24 4
gpt4 key购买 nike

我正在用一组图像创建视频。我的工作目的是创建一个没有压缩的 .mov 视频。我在开发人员库中看到它存在一个键“AVVideoCompressionPropertiesKey”,但我不知道如何使用此键指定不压缩。

你能帮帮我吗?

这是我的示例代码:

NSDictionary *videoCleanApertureSettings = [NSDictionary dictionaryWithObjectsAndKeys:
[NSNumber numberWithInt:320], AVVideoCleanApertureWidthKey,
[NSNumber numberWithInt:480], AVVideoCleanApertureHeightKey,
[NSNumber numberWithInt:10], AVVideoCleanApertureHorizontalOffsetKey,
[NSNumber numberWithInt:10], AVVideoCleanApertureVerticalOffsetKey,
nil];

NSDictionary *codecSettings = [NSDictionary dictionaryWithObjectsAndKeys:
[NSNumber numberWithInt:960000], AVVideoAverageBitRateKey,
[NSNumber numberWithInt:1],AVVideoMaxKeyFrameIntervalKey,
videoCleanApertureSettings, AVVideoCleanApertureKey,
nil];


NSDictionary *videoOutputSettings = [NSDictionary dictionaryWithObjectsAndKeys:AVVideoCodecH264, AVVideoCodecKey,codecSettings,AVVideoCompressionPropertiesKey, [NSNumber numberWithInt:size.width], AVVideoWidthKey,
[NSNumber numberWithInt:size.height], AVVideoHeightKey, nil];

self.videoWriterInput = [AVAssetWriterInput assetWriterInputWithMediaType:AVMediaTypeVideo outputSettings:videoOutputSettings];

最佳答案

尝试使用 AVVideoCodecJPEG 并将 AVVideoQualityKey 值设置为 NSNumber 1.0。另一种方法是指定 H264,将比特率设置为非常非常高的值,并将关键帧间隔指定为 1(即所有关键帧)。

关于ios - AVAssetWriter 如何创建无压缩的 mov 视频?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11296642/

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