none
Raw video data format

    Question

  • Hi Guys,

    This may sound like a stupid question, but im quite new to direct show.

    I was wondering what kind of data format the raw video data (after decoding) is in the memory. Is this bitmap format or something like it?

    Kind regards,

    Jasper

    Thursday, March 10, 2011 4:37 PM

All replies

  • It can be RGB, YUV, etc, depends on the decoder or source, see http://msdn.microsoft.com/en-us/library/ms919460.aspx for a list of media types.
    http://sourceforge.net/projects/videoprocessing
    Thursday, March 10, 2011 5:32 PM
  • If by bitmap you mean HBITMAP or a BMP file, the IMediaSample's buffer is never going to contain an HBITMAP or a BMP.

    An HBITMAP is the image data with a prefixed BITMAPINFOHEADER and a BMP is an HBITMAP with a prefixed BITMAPFILEHEADER.

    The sample only contains the image data while the BITMAPINFOHEADER is included in the VIDEOINFOHEADER[2] structure referenced by AM_MEDIA_TYPE::pbFormat field of the connection media type (according to its AM_MEDIA_TYPE::formattype).

    The format of the image data depends on the video subtype negotiated by the connected pins, which is stated as a GUID in AM_MEDIA_TYPE::subtype and as a FOURCC in BITMAPINFOHEADER::biCompression (the GUID is FOURCCMap(biCompression) but for BI_RGB or BI_BITFIELDS).

    An uncompressed video format is usually either an RGB or a YUV format. "bitmaps" usually only contain certain RGB formats. You can put any RGB or YUV in a "bitmap", but neither Windows nor most other bitmap readers will understand it.

    [RGB]

    http://msdn.microsoft.com/en-us/Library/dd407253.aspx

    http://msdn.microsoft.com/en-us/Library/dd391004.aspx

    [YUV]

    http://msdn.microsoft.com/en-us/Library/dd391027.aspx

    http://msdn.microsoft.com/en-us/library/ms867704.aspx

     


    MVP :: DirectShow / MediaFoundation <http://www.riseoftheants.com/mmx/faq.htm>
    Thursday, March 10, 2011 6:52 PM
  • Thanks for the clear answer.

    So to get this clear. While writing a good filter, you should support all there formats, to be sure it will always work?

    Thursday, March 10, 2011 11:49 PM
  • Lammers89 wrote:
    >
    >So to get this clear. While writing a good filter, you should support all
    >there formats, to be sure it will always work?
     
    You can't support EVERY format, there are just too many of them.
     
    The answer to your question depends on what you intend to do. Remember
    that DirectShow will insert extra filters to convert between pins, if
    possible. If you have a camera that produces YUV, and your transform
    filter only accepts RGB24, DirectShow will insert a decoder to convert the
    format.
     
    So, if you are writing a filter that can operate on either YUV or RGB, then
    advertise support for both. But if you only want to play in RGB, advertise
    that and DirectShow will fix things up.
    --
    Tim Roberts, timr@probo.com
    Providenza & Boekelheide, Inc.
     

    Tim Roberts, DDK MVP
    Friday, March 11, 2011 6:09 AM
  • You can't support EVERY format, there are just too many of them.

    Well, there are filters that do. Or, at least, they support more RGB and YUV variants than DS does on its own.

    So, if you are writing a filter that can operate on either YUV or RGB, then advertise support for both. But if you only want to play in RGB, advertise that and DirectShow will fix things up.

    That would be true if DS were a finished product. Things being as they are, the CSC can only convert between a few RGB formats and no ARGB ones, while the MSYUV codec used for YUV-to-RGB convertions supports very few YUV formats, missing even some common ones, and no YUV format with alpha, and it can not perform RGB-to-YUV at all.

    http://msdn.microsoft.com/en-us/Library/dd387892.aspx

    http://msdn.microsoft.com/en-us/Library/dd390907.aspx

    Only in Vista they finally added a real general converter for MediaFoundation, which should however also work in DS as a DMO. It still does not understand all RGB or ARGB variants however.

    http://msdn.microsoft.com/en-us/Library/dd443213.aspx

     


    MVP :: DirectShow / MediaFoundation <http://www.riseoftheants.com/mmx/faq.htm>
    Friday, March 11, 2011 6:12 PM