michaelmob / WebMCam

Capture frames in real-time and save them as WebM.
GNU General Public License v3.0
284 stars 27 forks source link

Unhandled exceptions (0x88890008) when Capture Audio #68

Open lxstudio opened 5 years ago

lxstudio commented 5 years ago

v2.4.1 works fine (visuals only) but when I select Capture Audio > Record, it throws an unhandled exception:

System.Runtime.InteropServices.COMException (0x88890008): Exception from HRESULT: 0x88890008 at System.Runtime.InteropServices.Marshal.ThrowExceptionForHRInternal(Int32 errorCode, IntPtr errorInfo) at NAudio.CoreAudioApi.WasapiCapture.InitializeCaptureDevice() at NAudio.CoreAudioApi.WasapiCapture.StartRecording() at Recorder.Start(Boolean recordAudio) at WebMCam.FormMain.buttonToggle_Click(Object sender, EventArgs e) at System.Windows.Forms.Control.OnClick(EventArgs e) at System.Windows.Forms.Button.OnClick(EventArgs e) at System.Windows.Forms.Button.WndProc(Message& m) at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

If I click Continue > Stop:

System.ArgumentOutOfRangeException: InvalidArgument=Value of '-1' is not valid for 'index'. Parameter name: index at System.Windows.Forms.ListBox.ObjectCollection.get_Item(Int32 index) at WebMCam.FormShowFrames.listBoxFrames_DrawItem(Object sender, DrawItemEventArgs e) at System.Windows.Forms.ListBox.OnDrawItem(DrawItemEventArgs e) at System.Windows.Forms.ListBox.WmReflectDrawItem(Message& m) at System.Windows.Forms.ListBox.WndProc(Message& m) at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

If I click Continue:

System.IO.IOException: The process cannot access the file 'audio.wav' because it is being used by another process. at System.IO.Directory.DeleteHelper(String fullPath, String userPath, Boolean recursive, Boolean throwOnTopLevelDirectoryNotFound, WIN32_FIND_DATA& data) at System.IO.Directory.Delete(String fullPath, String userPath, Boolean recursive, Boolean checkHost) at Recorder.Flush() at WebMCam.FormMain.buttonToggle_Click(Object sender, EventArgs e) at System.Windows.Forms.Control.OnClick(EventArgs e) at System.Windows.Forms.Button.OnClick(EventArgs e) at System.Windows.Forms.Button.WndProc(Message& m) at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

The FFmpeg Arguments are default:

-framerate {fps:avg} -i {format} {audio} -c:v {codec} -auto-alt-ref 0 -b:v 2M -r {fps:avg} {output}

I have verified FFmpeg install on my Windows 10, not sure how to go about fixing this with NAudio (?)