Question

I have a problem: I need to capture live source to file, but with every-minute slice (without loosing any frames). I think, I need some filter that can receive raw video at input pin, output the same, but it should be able to stop transfering through itself (with saving incoming samples in some buffer). So I can stop and delete filters after that filter (encoder and file-writer) with IFilterChain without stopping the entire graph, create it again and continue capturing. Well, my question is: is thare such filter? Or is there any another solution for my problem? Please, don't offer to stop the entire graph, change destination file and start it again (in that solution frames loosing appears). Also, I can't stop encoder and file-writer, change file and start them again, because I don't know, what filter is before encoder, maybe, it can not work with filter chain (For example, MJPEG Decompressor can't, IFilterChain::StopChain returns S_OK, but the entire graph stops, not only the encoder and file-writer)

Thank you!

Was it helpful?

Solution

This cannot be done in a single graph solution: changing a file requires transition through stopped state. Many filters don't even support dynamic reconnection.

Typical solution includes two filter graphs:

  1. Continuous capture, producing data without being ever stopped
  2. Per-file filter graph, receiving data from the first filter graph and routing it to a file.

You need a method to connect the two graphs so that the first one delivers data to the other. you might want to read up on GMFBridge, to either use it directly or get familiar with the concept.

See also (these and many other bridging related Qs, here and on MSDN DirectShow forum):

UPD. You don't have to use GMFBridge though. But you will have to do a similar thing anyway. Example - based on standard filters to maximal extent - might be: capturing through Sample Grabber Filter to Null Renderer Filter. Sample Grabber's callback copies data into input queue of custom source filter, based on PushSource Filter SDK sample, which is connected to File Writer Filter (through other filters) in the second graph.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top