I want to record video/audio in a series of fluid, variable length clips. That is, vid1.mp4 followed by vid2.mp4 should connect together seamlessly, or mostly seamlessly.
My current problem is that I cannot seem to switch files immediately without getting errors.
The crux of the issue is this:
func recordNewClip() {
let file = self.outputUrl()
let filePath = file!.path!
try? NSFileManager.defaultManager().removeItemAtPath(filePath)
movieOutput!.stopRecording()
movieOutput!.startRecordingToOutputFileURL(file, recordingDelegate: self)
}
If I don't call stopRecording
, I get errors, and if I do call stopRecording
, only random video clips ever record; most recordings fail.
How can I capture sequential video clips with AVFoundation?