Brad Ford
1 min readJan 25, 2018

--

Thanks for the bug number. The problem with your code is that you are not specifying an AVVideoAverageBitRate in your compression settings, so the codec is falling back to its default value. The default bitrate values are quite different for HEVC (30 mbit) and AVC (5 mbit). You can fix the problem by specifying a bitrate in your compression settings, like so:

let compressionProperties = [AVVideoAverageBitRateKey:5000000];

if #available(iOS 11.0, *) {

avAssetWriterInput = AVAssetWriterInput(mediaType: AVMediaType.video, outputSettings: [AVVideoCodecKey:type, AVVideoHeightKey:720, AVVideoWidthKey:1280, AVVideoCompressionPropertiesKey:compressionProperties])

} else {

avAssetWriterInput = AVAssetWriterInput(mediaType: AVMediaType.video, outputSettings: [AVVideoCodecKey:AVVideoCodecH264, AVVideoHeightKey:720, AVVideoWidthKey:1280, AVVideoCompressionPropertiesKey:compressionProperties])

}

--

--