3

I have a project where I need to record a video using DirectShow from a webcam, but I need to be able to stop recording while the preview continues to run.

I am using WPFMediaKit

http://wpfmediakit.codeplex.com/

The problem is that when I record a video the pause function also pauses the preview pane in the application

I am new to DirectShow, any suggestions how is can address this issue or a solution

Thank you very much.

P.S I use C# & WPF

David MZ
  • 3,648
  • 6
  • 33
  • 50
  • Did you tried creating two graphs? One for preview and the other one for recording? – yms Jun 01 '11 at 16:43
  • I am using the WPFMEdiaKit controls I don't know directshow that well so I guess they create one graph in that control – David MZ Jun 01 '11 at 21:18

3 Answers3

3

I don't know about the WPFMediaKit, but basically when you want to start/stop recording while keeping the preview, you will need two graphs, and something to connect between those graphs. Take a look at the pdf document at the GMFBridge page.

wimh
  • 15,072
  • 6
  • 47
  • 98
  • @David I think that your best choice is to follow Wimmel advice. Since you can download and modify the source codes for WPFMediaKit, it should be possible for you to integrate GMFBridge filter on it. – yms Jun 02 '11 at 22:31
  • I am doing it right now, I am getting an exception "No sample buffer allocator is available." are you familiar with this exception? – David MZ Jun 03 '11 at 22:13
3

If you can accept a momentary pause in preview when you start/stop recording and don't want to use something like a 2 graph GMFBridge approach, you can disconnect either the capture pin on the video capture source filter (assuming you are using separate preview and a capture pins from your source filter) or disconnect the File Writer chain portion of your capture sub-graph.

The issue here is the filtergraph must be paused before changes can be made to its topology, so you'd need to:

Pause Graph Disconnect or Reconnect File Writer chain Resume Graph

In my experience the temporary pause is not very noticeable.

  • Thank you, I took the weekend and combined GMFBridge with WPFMediaKit it works great together, I hope I can release this as a patch for WPFMediaKit open source project and help people in the future, I am willing to share the code with anyone who asks – David MZ Jun 07 '11 at 11:21
  • @David This was a good answer, you should at least upvote it. – yms Jun 09 '11 at 22:32
0

Please use StreamControl method of ICaptureGraphBuilder2, it provides you to control any filter in your Graph individually.

Lucky
  • 1