在DirectShow中以编程方式更改录制文件 [英] change recording file programmatically in directshow

查看:72
本文介绍了在DirectShow中以编程方式更改录制文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用DirectShow制作了一个控制台应用程序,该应用程序从实时源(现在是网络摄像头,然后是电视采集卡)中进行记录,在叠加中添加当前日期和时间,然后将音频和视频另存为.asf。
现在,我希望输出文件每60分钟更改一次,而不停止图形。我绝对不能失去直播的任何时间。
该图类似于这样:

I made a console application, using directshow, that record from a live source (now a webcam, then a tv capture card), add current date and time in overlay and then save audio and video as .asf. Now I want that the output file is going to change every 60 minutes without stopping the graph. I must not loose any seconds of the live stream. The graph is something like this one:

http://imageshack.us/photo/my-images/543/graphp.jpg/

看一下GMFBridge,但是我的示例有一些编译问题。
我想知道是否有一种方法可以将覆盖滤波器和音频源中存在的内容分离出来,将它们连接到另一个asf编写器(已暂停),然后每60分钟切换一次。
暂停的asf过滤器的文件名必须更改(pp.asf,pp2.asf,pp4.asf ...)。像这样的东西:

I took a look at the GMFBridge but I have some compiling problem with their examples. I am wondering if there is a way to split what exist from the overlay filter and audio source, connect them to another asf writer (paused) and then switch them every 60 minutes. The paused asf filter's file name must change (pp.asf, pp2.asf, pp4.asf ...). Something like this:

http://imageshack.us/photo/my-images/546/graph1f.jpg/

且pp1已暂停。我在互联网上发现一些人说,如果图形没有进入停止模式,则asf编写者会删除当前文件。

with pp1 paused. I found some people in internet that say that the asf writer deletes the current file if the graph does not go in stop mode.

推荐答案

解决方案是编写一个具有两个输入引脚的自定义DShow过滤器。一个用于音频流,另一个用于视频流。您应该在该过滤器内部(从体系结构的角度来看不必在内部,因为您也可以使用回调,例如在其他地方执行此操作),因此您应该创建asf文件。切换文件时,A / V数据将存储在缓存中(例如,足够大的循环缓冲区)。您还可以在该过滤器中观看和修改A / V同步。对于写入ASF文件,我建议使用Windows Media Format SDK。
如果需要进一步传递A / V数据以进行预览,并行流式传输等,也可以添加输出引脚。

The solution is in writing a custom DShow filter with two input pins in your case. One for audio stream and the other for video stream. Inside that filter (doesn't have to be inside from the architecture point of view, because you can also use callbacks for example and do the job somewhere else) you should create asf files. While switching files, A/V data would be stored in cache (e.g. big enough circular buffer). You can also watch and modify A/V sync in that filter. For writing ASF files I would recommend Windows Media Format SDK.
You can also add output pins if you like to pass A/V data further if necessary for preview, parallel streaming etc...

这篇关于在DirectShow中以编程方式更改录制文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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