AVAssetWriter如何创build没有压缩的movvideo?

我从一系列图像创buildvideo。 我的工作的目的是创build一个没有压缩的.movvideo。 我已经在开发库中看到它存在一个关键“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]; 

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

该键不是用于禁用压缩,是为某些编解码器指定特定的压缩值,如jpg或h264。

  [videoSettings addEntriesFromDictionary:[NSDictionary dictionaryWithObjectsAndKeys: AVVideoCodecH264, AVVideoCodecKey, nil]]; NSMutableDictionary* videoCompressionSettings = [NSMutableDictionary dictionary]; if ([[Preferences instance] recordingH264Keyframes] > 0) { [videoCompressionSettings addEntriesFromDictionary:[NSDictionary dictionaryWithObjectsAndKeys: [NSNumber numberWithInt:[[Preferences instance] recordingH264Keyframes]], AVVideoMaxKeyFrameIntervalKey, nil]]; } if ([[Preferences instance] recordingH264Bitrate] > 0) { [videoCompressionSettings addEntriesFromDictionary:[NSDictionary dictionaryWithObjectsAndKeys: [NSNumber numberWithInt:[[Preferences instance] recordingH264Bitrate]*1000], AVVideoAverageBitRateKey, nil]]; } if ([videoCompressionSettings count]) { [videoSettings addEntriesFromDictionary:[NSDictionary dictionaryWithObjectsAndKeys:videoCompressionSettings,AVVideoCompressionPropertiesKey,nil]]; } 

ProRes4444video编解码器是苹果提供给未压缩编解码器的最接近的东西。 此编解码器在iOS上仅适用于编写video内容OS X.

iOS上无法导出未压缩的video内容。