gpt4 book ai didi

swift - AVCaptureVideoDataOutput 中的无效键 -> ProfileLevel (macOS)

转载 作者:行者123 更新时间:2023-11-28 07:51:27 26 4
gpt4 key购买 nike

我正在向我的 AVCaptureVideoDataOutput 添加 key 。添加 key 时 AVVideoProfileLevelKey 系统抛出我 ->

Failed to set (contentViewController) user defined inspected property on (NSWindow): *** +[AVVideoOutputSettings videoOutputSettingsWithVideoSettingsDictionary:] Output settings dictionary contains one or more invalid keys: ProfileLevel

let captureSession = AVCaptureSession()
var videoCaptureOutput = AVCaptureVideoDataOutput()
videoCaptureOutput.videoSettings = [AVVideoCodecKey: AVVideoCodecType.h264,
AVVideoWidthKey : 1280,
AVVideoHeightKey : 720,
AVVideoProfileLevelKey : AVVideoProfileLevelH264HighAutoLevel] as [String : Any]

key 是 AVVideoSettings.h 的一部分,AVVideoCodecKeyAVVideoWidthKeyAVVideoHeightKey 也是,但不清楚告诉我在哪里可以找到 AVCaptureVideoDataOutput 支持的键。

最佳答案

键及其构建方式在(键入 AVVideoCodecKey 并跳转到定​​义)中进行了描述。在你的特殊情况下 AVVideoProfileLevelKey : AVVideoProfileLevelH264HighAutoLevel 应该放在另一个字典中,这个字典应该设置为 AVVideoCompressionPropertiesKey:

let compressionSettings = [AVVideoProfileLevelKey: AVVideoProfileLevelH264HighAutoLevel]
videoCaptureOutput.videoSettings = [AVVideoCodecKey: AVVideoCodecType.h264,
AVVideoWidthKey : 1280,
AVVideoHeightKey : 720,
AVVideoProfileLevelKey : compressionSettings]

希望对大家有帮助

关于swift - AVCaptureVideoDataOutput 中的无效键 -> ProfileLevel (macOS),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49549710/

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