我正试着用AVAssetWriter录制一段视频。我需要更深入的控制输出,而不是AVAssetExportSession提供的预置.我试图在我的AVVideoScalingModeFit中使用输出模式AVAssetWriterInput,但这会导致崩溃,声明:
AVAssetWriterInput目前不支持AVVideoScalingModeFit
下面是我使用的视频设置:
let videoSettings: [String : Any] = [
AVVideoCodecKey: AVVideoCodecH264,
AVVideoWidthKey: 450,
AVVideoHeightKey: 450,
AVVideoScalingModeKey: AVVideoScalingModeFit,
AVVideoCompressionPropertiesKey: [
AVVideoAverageBitRateKey: 1000000,
AVVideoProfileLevelKey: AVVideoProfileLevelH264Baseline41,
AVVideoAllowFrameReorderingKey: false,
AVVideoExpectedSourceFrameRateKey: 23
]
]我的问题有两个: 1)如果我不能使用它,为什么会有这种模式? 2)如果我能使用它,我应该怎么做?
其他人提出了这一问题,但仍未得到答复。见:here。
发布于 2017-12-12 23:45:20
1)仅仅因为AVAssetWriter不支持AVVideoScalingModeKey,并不意味着它在AVFoundation的其他地方不受支持。
2)使用Core或VTPixelTransferSession或任何适合您的管道的内容,自己缩放视频帧。
https://stackoverflow.com/questions/46933782
复制相似问题