I’ve been engaged on video compression in iOS Swift, and following this SO’s reply. It’s working tremendous till I modify this piece of code’s file format to .mp4
let videoWriter = attempt! AVAssetWriter(outputURL: outputURL as URL, fileType: AVFileType.mov)
There are causes that I want the output in .mp4 file format. So after I try this it crashes the app. So I searched on SO and located this query related to my downside.
however now the problem is when I attempt to add its reply to my operate it provides me error anAudioSampleBuffer not outlined. As I’m completely new to audio/video area, I’m unable to grasp why it’s giving me this. And learn how to resolve this.
The piece of code from reply that I’m including with my operate is beneath.
//setup audio author //let formatDesc = CMSampleBufferGetFormatDescription() //let audioWriterInput = AVAssetWriterInput(mediaType: AVMediaType.audio, outputSettings: nil, sourceFormatHint: formatDesc) let audioWriterInput = AVAssetWriterInput(mediaType: AVMediaType.audio, outputSettings: nil) audioWriterInput.expectsMediaDataInRealTime = false videoWriter.add(audioWriterInput)
The commented half is just not working. Any assist can be appreciated Thanks.