1

I'm trying to encode raw video frames into mpeg2 video using MPEG2 Encoder in Directshow. Filter CLSID_CMPEG2EncoderVideoDS from file wmcodecdsp.h. I've created my own push source filter which inject raw frame to the filter graph. The input frame format is RGB24. However my filter graph is failing when I'm trying to connect outpin of Push source filter to the input of MPEG2 video encoder.

The filter graph has following structure.

Push Source ---> MPEG2 Video Encoder ---->AVI Muxer--->Filer Write (container format .avi).

I found the actual cause of failure is due to mismatch of media format between output pin of Push filter and input pin of MPEG2 Encoder.

The media format for output pin of Push filter is

  1. Formattype = FORMAT_VideoInfo.
  2. Major Type = MEDIATYPE_Video.
  3. Minor Type = MEDIASUBTYPE_RGB24.
  4. cbformat = 88.

However the media format at input pin of MPEG2 Encoder is different for minor type and cbformat (basically the GUIDs are not matching). Is it possible to set media format for MPEG2 Encoder manually by using SetMediaFormat(). On MSDN site it is mentioned that MPEG2 Encoder support RGB24 input format. I've tried my filter graph with other encoder like MJPEG compressor. It works fine. Please share your thoughts.

Thanks and Regards

Pradeep

4

0 回答 0