DirectShow捕获到多个文件 [英] DirectShow capturing to multiple files

查看:86
本文介绍了DirectShow捕获到多个文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个问题:我需要捕获实时源文件到文件,但要有分钟的时间片(不丢失任何帧)。我认为,我需要一个可以在输入引脚上接收原始视频,输出相同视频的过滤器,但它应该能够停止通过自身传输(将传入的样本保存在某个缓冲区中)。因此,我可以使用IFilterChain停止并删除该过滤器(编码器和文件写入器)之后的过滤器,而无需停止整个图形,再次创建它并继续捕获。好吧,我的问题是:皮尔这样的过滤器吗?还是我的问题有其他解决方案?请不要停止整个图形,更改目标文件然后重新启动(因为这样会出现解决方案框架松动)。另外,我无法停止编码器和文件写入器,更改文件并再次启动它们,因为我不知道编码器之前是什么过滤器,也许它不能与过滤器链配合使用(例如,MJPEG Decompressor可以t,IFilterChain :: StopChain返回S_OK,但是整个图形都停止了,不仅是编码器和文件写入器)。

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)

谢谢!

推荐答案

这不能在单个图形解决方案中完成:更改文件需要从停止状态过渡。许多过滤器甚至不支持动态重新连接。

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. 连续捕获,在不停止的情况下产生数据

  2. 每个文件过滤器图,从第一个过滤器图接收数据并将其路由到文件。

您需要一种方法来连接两个图形,以便第一个图形将数据传递到另一个图形。您可能想阅读 GMFBridge ,直接使用它或熟悉它。概念。

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.

另请参见(这些和许多其他桥接相关的Q,在此处以及MSDN DirectShow论坛上):

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

  • GMFBridge usage in DirectShow
  • Directshow - Stop and close a file (but reuse graph and some filters)
  • When changing a file name, Recording Start is overdue for 3 seconds.
  • change recording file programmatically in directshow
  • DirectShow play two video files in a sequence?

UPD。不过,您不必使用GMFBridge。但是无论如何,您都必须做类似的事情。示例-基于最大程度的标准过滤器-可能是:通过Sample Grabber过滤器捕获到Null Renderer过滤器。 Sample Grabber的回调基于PushSource Filter SDK示例将数据复制到自定义源过滤器的输入队列中,该示例在第二张图中连接到File Writer过滤器(通过其他过滤器)。

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.

这篇关于DirectShow捕获到多个文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆