gpt4 book ai didi

c++ - 如何使用 DirectShow 将 WDM 格式的视频捕获为 MPEG 格式?

转载 作者:行者123 更新时间:2023-11-30 04:36:48 30 4
gpt4 key购买 nike

我想从视频源捕获视频并使用 DirectShow 将其编码为 MPEG 格式。如何设计 Capture Graph 以及如何为 MPEG 格式设置视频属性(例如比特率、帧率、分辨率等)

最佳答案

我的方法(我在制作 VideoPhill recorder 时使用的)是使用 DirectShow.net仅用于捕获帧,然后使用 SampleGrabber 过滤器创建帧队列,稍后将其送入编码器 - 我使用 StandardMPEG为此。

我的愿望是大部分时间都处于受管理的状态 - 使用这种方法我能够做到这一点。

后来 - 这似乎是正确的方法,因为现在我可以将各种编码器直接连接到一个捕获设备。以前只有使用 SimulStream (tm) 才有可能.不仅如此,您还可以使用无法用作 DS 过滤器的编码器。

关于使用样本采集器(来自 DirectShow.net 站点 - faq section):

Q9: Where do I find the BaseClasses? How do I write a filter in c#?

The base classes have not been translated to be used from .NET. After two attempts to do so, well, let's just say they weren't designed with managed code in mind.

That said, however, you do still have choices. First of all, you can use the sample grabber to capture video frames. These frames can be edited however you like before letting them continue on to the next filter in the graph. See the DxLogo sample (among others) for how this is done.

Secondly, you can write a DirectX Media Object (DMO). There are two samples included with the lib that show how this is done. While there are limitations on DMOs that regular filters don't have, you may find those limitations aren't a problem for you. There are extensive docs (including a CHM file) that talk about how to do this.

Thirdly, there is a sample named GSSF. You can use this if you want to create a source filter (ie the filter in the graph that generates the stream).

关于c++ - 如何使用 DirectShow 将 WDM 格式的视频捕获为 MPEG 格式?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4290609/

30 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com