gpt4 book ai didi

ios - AVAssetWriterInput 当前不支持 AVVideoScalingModeFit - IOS 错误

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

我正在尝试使用 AVAssetWriterInput 裁剪我在应用程序的截屏视频中阅读的视频。这是我当前的配置。

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


NSDictionary *videoAspectRatioSettings = [NSDictionary dictionaryWithObjectsAndKeys:
[NSNumber numberWithInt:3], AVVideoPixelAspectRatioHorizontalSpacingKey,
[NSNumber numberWithInt:3],AVVideoPixelAspectRatioVerticalSpacingKey,
nil];

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

NSDictionary *videoSettings = @{AVVideoCodecKey:AVVideoCodecH264,
AVVideoCompressionPropertiesKey:codecSettings,
AVVideoScalingModeKey:AVVideoScalingModeResizeAspectFill,
AVVideoWidthKey:[NSNumber numberWithInt:320],
AVVideoHeightKey:[NSNumber numberWithInt:480]};

_videoWriterInput = [AVAssetWriterInput assetWriterInputWithMediaType:AVMediaTypeVideo outputSettings:videoSettings];

我收到以下错误:“AVAssetWriterInput 当前不支持 AVVideoScalingModeFit”

对于使用此库的任何人来说,这是一个常见错误,但我找不到真正的解决方案。我只是看到人们说:“我最终弄明白了”,却没有解释。问题肯定与这一行有关:“AVVideoScalingModeKey:AVVideoScalingModeResizeAspectFill”,它告诉 AVAssetWriter 裁剪视频并保持纵横比。有人知道解决这个问题的方法吗?

最佳答案

本身没有“解决方案”。它根本不受支持。您需要使用 Core Image 或 VTPixelTransferSession 或任何适合您的管道的内容自行缩放视频帧。

关于ios - AVAssetWriterInput 当前不支持 AVVideoScalingModeFit - IOS 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32674916/

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