gpt4 book ai didi

ios - AVCaptureVideoData输出分辨率

转载 作者:行者123 更新时间:2023-11-28 13:44:49 24 4
gpt4 key购买 nike

我试图在视频设置中将输出尺寸指定为 960x720。但是,它似乎不起作用。

self.videoDataOutput = AVCaptureVideoDataOutput()  
if self.session.canAddOutput(self.videoDataOutput!) {
self.session.addOutput(videoDataOutput!)
self.videoDataOutput!.videoSettings = [kCVPixelBufferPixelFormatTypeKey: Int(kCVPixelFormatType_32BGRA),
kCVPixelBufferHeightKey: 960,
kCVPixelBufferWidthKey: 720] as [String : Any]

}

还有其他方法可以以自定义的较低分辨率输出视频数据吗?

最佳答案

很抱歉,您应该遵守这些预设中的任何一个

https://developer.apple.com/documentation/avfoundation/avcapturesession/preset

或者使用这个库来扩展它

https://github.com/NextLevel/NextLevelSessionExporter

这是相关的部分

let exporter = NextLevelSessionExporter(withAsset: asset) 
exporter.videoOutputConfiguration = [
AVVideoCodecKey: AVVideoCodec.h264,
AVVideoWidthKey: NSNumber(integerLiteral: 720),
AVVideoHeightKey: NSNumber(integerLiteral: 960),
AVVideoScalingModeKey: AVVideoScalingModeResizeAspectFill,
AVVideoCompressionPropertiesKey: compressionDict
]

关于ios - AVCaptureVideoData输出分辨率,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55550887/

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