1

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,

Custom File Format And Codec?

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.

Community
  • 1
  • 1
boogagiga
  • 49
  • 8

1 Answers1

1

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. Standard DMO Wrapper Filter will wrap your DMO into a DirectShow filter. It is definitely easier to write a DMO, including that you can use ATL as COM base.

Roman R.
  • 68,205
  • 6
  • 94
  • 158
  • Wow. How did this documention elude my Google searches? – boogagiga Dec 29 '11 at 22:32
  • Anyway, thanks for the information. I will go through those articles and see what I can make of it. – boogagiga Dec 29 '11 at 22:33
  • @RomanR. That DMO page you linked says that DMO's have been superseded by MFT's. Do you have any opinion on this? If one was starting a new project would you recommend MFT or DMO? My concern is that sometimes Microsoft occasionally supersedes a protocol layer with a new one, but one that is never fully adopted and ends up in a "limbo" state. If the answer is MFT, is there an equivalent to the DMO Wrapper Filter or is that not necessary with MFT's? – Robert Oschler Dec 30 '11 at 01:20
  • MFTs are isolated to Media Foundation API. It is a newer one - yes - but you should have a reason to use it as it yet has a worse coverage as compared to DirectShow. Also FYI, DMO and MFT interfaces are similar, Microsoft even offers dual DMO/MFT objects. – Roman R. Dec 30 '11 at 01:52