Answered Preview Panel Frozen / Choppy

  • Tuesday, April 24, 2012 10:23 PM
     
      Has Code

    Hello,

    I am using DirectShow to capture a video of a user sitting at one of our KIOSK for a convention. I use the ffdshow video codec to compress. I display a preview / live video of the user on a panel in WPF. During the preview stage the camera tracks just fine with user movement. Once I begin recording however the preview panel is mostly frozen but when it does do updates it is choppy and then goes into a frozen state again. At first I thought my hardware was being taxed but running / watching hardware data as the recording is going reveals nothing...well nothing that clues me into hardware trouble. I am new to DirectShow so I am posting what I think to be the relevant / helpful code. If you need something else I will gladly post it.

    TIA

    JB

    private System.Windows.Forms.Panel pnlPreview = null;
    private Capture dxCapture = null;
    private void SetupPreviewHostPanel()
    {
       System.Windows.Forms.Integration.WindowsFormsHost host = new System.Windows.Forms.Integration.WindowsFormsHost();
       pnlPreview = new System.Windows.Forms.Panel();
       host.Child = pnlPreview;
       gridControlHost.Children.Add(host);
    }
    private void Page_Loaded(object sender, RoutedEventArgs e)
    {
       SetupPreviewHostPanel();
       RebuildDXCaptureObject();
       dxCapture.PreviewWindow = pnlPreview;
    }
    As I said the preview is fine the trouble is when recording is live and updating the preview panle so the user can see themselves as they record.

All Replies

  • Wednesday, April 25, 2012 9:07 PM
     
     Answered

    I figured it out and it was a dumb developer mistake. The compressors were getting set at two places. Once in an app.config file and once from a generated collection of codecs on the machine. They were stepping on each other and I didn't figure it out as fast as I should have. Anyway it was using an old and slow codec even though I *THOUGHT* it was using a different one. Works like a charm now.

    JB

    • Marked As Answer by zzpluralza Wednesday, April 25, 2012 9:07 PM
    •