 
       SceneKitVideoRecorder.renderSemaphore.wait()
 
+      if !(self?.useAudio)! {
+        self?.firstAudioTimestamp = kCMTimeZero
+      }
+
       guard self?.startInputPipeline() == true else {
         print("AVAssetWriter Failed:", "Unknown error")
         SceneKitVideoRecorder.renderSemaphore.signal()


  private func prepare(with options: Options) {

    self.options.videoSize = options.videoSize

    writer = try! AVAssetWriter(outputURL: self.options.outputUrl,

    if useAudio {
      audioInput.markAsFinished()
    }

    endingTimestamp = getCurrentCMTime()

    stopDisplayLink()
    captureSession.stopRunning()

    isRecording = false
    isPrepared = false
    videoFramesWritten = false

    initialTime = kCMTimeInvalid
    currentTime = kCMTimeInvalid
    videoStartTimestamp = kCMTimeZero
    firstVideoTimestamp = kCMTimeZero
    firstAudioTimestamp = kCMTimeInvalid

    writer.finishWriting(completionHandler: { [weak self] in
      completionHandler(outputUrl)
