public void combineFiles() { try { // Process.Start("ffmpeg", "-i " + filename + " -i " + filenameAudio + " -c:v copy -c:a aac -strict experimental " + filenameCombined + ""); string FFmpegFilename; string[] text = File.ReadAllLines(MainWindow.executingDirectory + "\\Config\\FFMPEGLocation.txt"); FFmpegFilename = text[0]; process = new Process(); process.StartInfo.RedirectStandardOutput = true; process.StartInfo.RedirectStandardError = true; process.StartInfo.FileName = FFmpegFilename; // process.StartInfo.FileName = @"C:\FFmpeg\bin\ffmpeg.exe"; process.StartInfo.Arguments = "-i " + filename + " -i " + filenameAudio + " -c:v copy -c:a aac -strict experimental " + filenameCombined + " -shortest"; process.StartInfo.UseShellExecute = false; process.StartInfo.CreateNoWindow = true; process.Start(); process.WaitForExit(); vf.Dispose(); AudioSource.Dispose(); } catch (Exception xx) { int x = 0; x++; } }
// 停止の初期化 private void CloseVideoSource() { if (!(videoSource == null)) { if (videoSource.IsRunning) { videoSource.SignalToStop(); videoSource.WaitForStop(); videoSource = null; Console.Out.WriteLine("videoSource Disposed"); } } if (!(audioSource == null)) { if (audioSource.IsRunning) { audioSource.SignalToStop(); audioSource.WaitForStop(); } audioSource.Dispose(); audioSource = null; Console.Out.WriteLine("audioSource Disposed"); } finalizeXAudio2(); }
private void Dispose(bool disposing) { if (!_disposed) { if (disposing) { _recognizer.Dispose(); _audioCapture.Dispose(); _audio.Dispose(); _transcript.Dispose(); } _disposed = true; } }
public async void RecordAudioToFile(string _path = "1.wav") { if (_microphone == null) { SetRecorder(); } if (FinishRecord == null) { throw new Exception("FinishRecord function not set!"); } if (_path == null) { throw new ArgumentNullException("Error! Argument path is null!"); } else if (_path != "1.wav") { RecordPath = _path; } Task t = new Task(OnListeningAsync); try { _fileStream = new FileStream(RecordPath, FileMode.OpenOrCreate, FileAccess.Write); _audioSaver = new WaveEncoder(); _audioSaver.Open(_fileStream); IsRecordContinue = true; _microphone.Start(); t.Start(); await t; _microphone.WaitForStop(); } catch (Exception e) { Console.WriteLine("Exception: " + e.Message); } finally { t.Dispose(); _microphone.Dispose(); _audioSaver?.Close(); _fileStream?.Close(); IsRecordContinue = false; } }