创建自定义视频 DShow 编解码器
我已经搜索过(谷歌和论坛),但仍然找不到答案。我通过这个帖子接近了这个网站,
但是没有直接回答我的问题。
基本上,我想创建一个自定义视频编解码器来充当 DShow 过滤器。我不是在问如何对视频进行编码和解码,我需要/想知道如何设置我的过滤器以正确地与媒体播放器(如 WMP)交互。
平台:Windows 7 64 位
媒体播放器:任何。如果将自定义编解码器与不同的播放器连接起来更容易,请务必推荐该播放器。
语言:C++
我的理解是,如果我以 .ax 或 .dll 的形式创建 DShow 过滤器,我只需使用 regsvr32 将其注册到 Windows,然后 WMP 将能够使用该编解码器打开文件。在这种情况下,我只会使用 AVI 容器来容纳我的编解码器。
我之前为 DAW 制作过 VST 插件,并且对程序的结构有要求。它需要包含主机程序(逻辑、专业工具等)用来处理音频数据的某些函数(具有特定名称)。例如,有 process 和 processReplacing 方法,这是必需的。
我一直试图找出视频编解码器的结构,以便我可以与标准播放器正确连接,但无济于事。
任何帮助将不胜感激。提前致谢。
I've searched (Google and forums) and I still can not find an answer to this. I got close on this site with this thread,
but that is not directly answering my question.
Basically, I want to create a custom video codec that will act as a DShow filter. I'm not asking about how to go about encoding and decoding the video, I need/want to know how to go about setting up my filter to properly interface with media players (like WMP).
Platform: Windows 7 64-bit
Media Player: Any. If it's easier to interface a custom codec with a different player, by all means recommend that player.
Language: C++
My understanding is that if I create a DShow filter in the form of a .ax or .dll, I just need to register it with windows using regsvr32, and WMP will then be able to open files using that codec. In which case, I would just use an AVI container to house my codec.
I've made VST plugins before for DAWs and there were requirements with respect to the structure of the program. It needed to contain certain functions (with specific names) that the host program (logic, pro tools, etc) would use to process the audio data with. For example, there are the process and processReplacing methods, which are required.
I've been trying to find out what the structure is for video codecs so I can interface properly with standard players to no avail.
Any help would be appreciated. Thanks in advance.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在 DirectShow 中,您选择新的/唯一的视频子类型标识符(即
GUID
,因此您可以真正获得唯一的标识符),创建编码器和解码器过滤器,使用 DirectShow 智能连接正确注册它们,然后就可以了去。编码器和解码器过滤器是注册用于对视频数据进行某些转换的 COM 对象。 MSDN 在编写转换过滤器中描述了它们,它假定您熟悉 DirectShow 概念。
如果您希望能够将数据存储到 AVI 容器中,则您的子类型标识符仅限于 32 位“四字符代码”(
FourCC
),该代码将使用预定义映射转换为子类型 GUID 。借助 DirectShow 的智能连接,支持 DriectShow 的应用程序将能够自动定位并安装解码器以便播放数据。 WMP 在播放文件时使用 DirectShow 作为第二个更改 API,因此 WMP 还能够接受内部使用您的编解码器的文件。
另外,突然编写 DirectShow 过滤器可能是一件复杂的事情。由于您仅对视频编码器/解码器适配程序感兴趣,因此您可能更喜欢编写
DirectX 媒体对象
(DMO
)。标准DMO Wrapper Filter
会将您的DMO
包装到DirectShow 过滤器中。编写 DMO 肯定更容易,包括您可以使用ATL< /code>
作为 COM 基础。
In DirectShow you choose new/unique video subtype identifier (which is
GUID
so you can really get a unique one), you create encoder and decoder filters, you register them properly with DirectShow Intelligent Connect and you are good to go.Encoder and decoder filters are COM objects registered to do certain transformation of video data. MSDN describes them in Writing Transform Filters, which assumes though that you are familiar with DirectShow concepts.
If you want to be able to store your data into AVI container, your subtype identifier is limited to 32-bit 'four character code' (
FourCC
) which is to be converted to subtype GUID using a predefined mapping.Thanks to DirectShow's Intelligent Connect, DriectShow-enabled applications will be able to automatically locate and mount your decoder in order to play data back. WMP uses DirectShow as a second change API when it comes to play a file, so WMP will also be able to accept files which internally use your codec.
Also, writing a DirectShow filter out of the blue might be a sort of complicated thing. As you are interested in video encoder/decoder fitlers only, you might want to prefer writing a
DirectX Media Object
(DMO
) instead. StandardDMO Wrapper Filter
will wrap yourDMO
into a DirectShow filter. It is definitely easier to write a DMO, including that you can useATL
as COM base.