Page 1 of 1

VideoCaptureDevice crashes application in portrait mode

PostPosted: Fri Feb 19, 2016 12:16 pm
by AndrewR
I am building a WPF application using AForge library to capture video from webcam, and I am using the monitor in a portrait mode. Application crashes after videoSource.Start(); but before entering video_NewFrame handler. When I turn my monitor in landscape mode, everything works fine. Looks like it's a library bug, but is it any way to bypass this bug? And how VideoCaptureDevice functionality is even related to monitor orientation?

Code: Select all
void UserControl_Loaded(object sender, RoutedEventArgs e)
{
    var videoDevices = new FilterInfoCollection(FilterCategory.VideoInputDevice);
    if (videoDevices.Count != 0)
    {
        videoSource = new VideoCaptureDevice(videoDevices[0].MonikerString);
        videoSource.NewFrame += new NewFrameEventHandler(video_NewFrame);
        videoSource.Start();
    }
}

Re: VideoCaptureDevice crashes application in portrait mode

PostPosted: Sat Feb 20, 2016 3:52 pm
by andrew.kirillov
I would suggest debugging it and find the line of code causing the crash.

Re: VideoCaptureDevice crashes application in portrait mode

PostPosted: Tue Mar 01, 2016 1:48 pm
by AndrewR
Traced the error to quartz.dll. Looks like it's a DirectShow error.

Re: VideoCaptureDevice crashes application in portrait mode

PostPosted: Mon Feb 27, 2017 9:55 pm
by nmasry
Can i know please how to change camera orientation to portrait ?