BradLarson / GPUImage2

GPUImage 2 is a BSD-licensed Swift framework for GPU-accelerated video and image processing.
BSD 3-Clause "New" or "Revised" License
4.87k stars 608 forks source link

Crash when adding audioEncodingTarget to a Camera object #157

Open jordimares opened 7 years ago

jordimares commented 7 years ago

Hi,

I am facing a very strange problem. I have my Camera working in iOS 10 and Swift 3.2 to record videos without audio. However, when I add the line camera.audioEncodingTarget = movieOutput my app crashes badly with a SIGABRT. Any ideas on what can be happening?

I have the following in the viewDidLoad() method:

camera = try Camera(sessionPreset:AVCaptureSessionPresetHigh)
camera --> renderView
camera.startCapture()

And the following in the method triggered when I tap the record button:

movieOutput = try MovieOutput(URL:videoPath, size:Size(width:480, height:640), liveVideo:true)
camera.audioEncodingTarget = movieOutput
filter! --> movieOutput!
movieOutput!.startRecording()

The app crashes in the line camera.audioEncodingTarget = movieOutput

justinmiller62 commented 7 years ago

Replace your MovieOutput.swift with the following and it should solve your issue, you can also look at what was changed but it boils down to when audio and video start recording.

https://github.com/justinmiller62/GPUImage2/blob/a3826ee5c93d350a1f3336f70c32ea312eb88740/framework/Source/Mac/MovieOutput.swift

iOSDigital commented 3 years ago

@justinmiller62 Thank you so much for this. I was having so many issues with the audio recording. Dropped your file in, works perfectly.