Record and view video at the same time DirectShow

0

I have used the sample code of DirectShow in order to record a video. however, I want to display the video during recording as well. But I can't do it at the same time, this error always shows:

' Const VIDEODEVICE As Integer = 0
' zero based index of video capture device to use
Cursor.Current = Cursors.WaitCursor

If cam Is Nothing Then
    cam = New AsfFilter.Capture(VIDEODEVICE, textBox1.Text)
    previewCamera(PictureBox1) <----- this is my code regarding on previewing the video recording.
    cam.Start()

    button1.Text = "Stop"
    textBox1.[ReadOnly] = True
Else
    button1.Text = "Start"
    textBox1.[ReadOnly] = False

    ' Pause the recording
    cam.Pause()

    ' Close it down
    cam.Dispose()
    cam = Nothing
End If

Cursor.Current = Cursors.[Default]

Error:

Insufficient system resources exist to complete the requested service. (Exception from HRESULT: 0x800705AA)

What am I doing wrong? Did somebody know of this?

vb.net
exception-handling
directshow
video-capture
directshow.net
asked on Stack Overflow Jan 18, 2013 by Break the Law • edited Jan 18, 2013 by abatishchev

1 Answer

0

0x800705AA: ERROR_NO_SYSTEM_RESOURCES "Insufficient system resources exist to complete the requested service."

Here is the thing you need to know: video capture devices are exclusive access resources. You use it once, you cannot use it simultaneously again on another filter graph (that is, one graph for recording, and another one for monitoring). You have to have single filter graph to host video capture. From there, you can either use Smart Tee Filter, or Infinite Pin Tee Filter to duplicate the video feed on recording and monitoring legs. Or, alternatively, use multigraph solution with still video capture taking place on single graph.

answered on Stack Overflow Jan 18, 2013 by Roman R.

User contributions licensed under CC BY-SA 3.0