mediacapture stoprecordasync corrupts video record file upon USB webcam device disconnect RRS feed

  • Question


    We ported our application to Microsoft Windows 8 Metro (OpenCV to windows. media.capture), and immediately experienced the below issue for the first time.

    Is seems the stoprecordasync() does not handle the disconnection of a USB webcam in the middle of recording a video file.  The result is a corrupted video file (.mp4) that was not closed properly by the application.   This is handled gracefully using OpenCV and with our Android application. 


    public async void Failed(MediaCapture currentCaptureObject, MediaCaptureFailedEventArgs currentFailure)

        await Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, async () =>


            if (m_bRecording)



                    await m_mediaCaptureMgr.StopRecordAsync();


                catch (Exception ex)


                   // Results:

                   // (1) A first chance exception of type 'System.Exception' occurred in mscorlib.dll

                   // (2) WinRT information: The video recording device is no longer present.

                   // (3) Saved video recorded file is corrupted





    We tested Microsoft's own Camera metro-application to record a video file, that when you disconnect the USB webcam during recording the result is the same with a corrupted video file.  Which points to the issue resides within the windows.media.capture library code.


    Anybody have a workaround or know when Microsoft plans to fix this issue?>

    • Edited by SK 7878 Saturday, February 7, 2015 3:33 PM
    • Moved by Fred Bao Monday, February 9, 2015 2:30 AM Windows Store App Releated
    Saturday, February 7, 2015 3:30 PM

All replies

  • Hello,

    It seems that you are developing with the windows store app project, i move it to the store app forum there are store app experts will help you.

    The current forum you posted to is used to discuss and ask questions about .NET Framework Base Classes (BCL) such as Collections, I/O, Regigistry, Globalization, Reflection.


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Monday, February 9, 2015 2:29 AM