Does DirectShow allow one to decode virtually any

2019-08-23 11:59发布

问题:

I am comparing VFW, MediaFoundation, and DirectShow.. Although VFW is very old and dated, it at least allows a lot of flexibility in encoding and decoding videos because you can choose virtually any encoder/decoder, AFAIK, and you are not limited to a subset of decoders/encoders that only microsoft has chosen.

Does DirectShow offer the ability to decode (decompress) multiple video kinds (like vfw) using any chosen codec, or must you only use a subset that microsoft has chosen?

Indeed some api's require writing your own custom system to decode, but I am wondering about "out of the box" functionality (ready to use) without as much custom code required. VFW (video for windows) seems to offer this, by using pre-ready decoders/encoders with no work required by you, but VFW is dated and might be obsolete at some point - but seems to require the least coding effort.

回答1:

DirectShow is flexible and is open to developer. Such openness is from time to time abused and is a point of criticism:

Codec hell (a term derived from DLL hell) is when multiple DirectShow filters conflict for performing the same task. A large number of companies now develop codecs in the form of DirectShow filters, resulting in the presence of several filters that can decode the same media type

Also, DirectShow did not receive any significant development for many years and for this reasons is sometimes thought of as deprecated, which is not quite true, and a great deal of software out there including Microsoft's own are still heavily dependent on DirectShow. “… you will never get the same high quality video experience that you find with DirectShow” - I have a few quotes collected here and they are in good standing.

Yes you can build pipelines flexibly and use decoders/encoders (as well as other parts of pipeline collectively referred to as "filters") of your choice.

DirectShow API offers the widest choice of third party components, is covered by a multitude of samples on Internet, is way more powerful than VFW and not as restrictive and scarce as Media Foundation. Yet it's somewhat outdated, dependent on pretty old BaseClasses code base in customized development and is generally known to have a steep learning curve.

To get a quick idea about DirectShow you can download the best interactive tool for DirectShow development GraphStudioNext and use menu File, Render Media File to build a playback pipeline for standard media files like .MP4s. You will be able to change the pipeline interactively and this is presenting what you are supposed to do programmatically as well.