private void JoinFiles(string filePath, FfmpegPipe videoPipe, FfmpegPipe audioPipe) { m_isSaving = true; try { videoPipe.WaitForEncoderExit(/*ms*/ 20 * 1000); if (audioPipe.OutputFile.Length > 0) { audioPipe.WaitForEncoderExit(/*ms*/ 20 * 1000); if (FfmpegPipe.Mux(audioPipe.OutputFile, videoPipe.OutputFile, filePath)) { System.IO.File.Delete(videoPipe.OutputFile); System.IO.File.Delete(audioPipe.OutputFile); } } m_playbackLoops = 0; } catch (System.Exception e) { UnityEngine.Debug.LogException(e); } finally { m_isSaving = false; } }
private void RemoveFile(string filePath, FfmpegPipe videoPipe, FfmpegPipe audioPipe) { try { videoPipe.WaitForEncoderExit(/*ms*/ 20 * 1000); System.IO.File.Delete(videoPipe.OutputFile); if (audioPipe.OutputFile.Length > 0) { audioPipe.WaitForEncoderExit(/*ms*/ 20 * 1000); System.IO.File.Delete(audioPipe.OutputFile); // Remove the primary file last, to avoid file collisions with the next recording. System.IO.File.Delete(filePath); } } catch (System.Exception e) { UnityEngine.Debug.LogException(e); m_isSaving = false; } }