Need help to create DirectShow filter to read RGB 32/RGB 24 bit pixels
-
Hi to all, I am creating a DirectShow filter, that will only read the RGB pixel (32 bit) from MPEG-2 input video source. I am connecting it after MPEG-2 Video Decoder as follows, MPEG-2 Video Decoder --> My Custom Filter --> Video Renderer I am receiving video size from My Custom Filter is 720x480, but actual video size if 720x576. Code within CheckInputType(const CMediaType *mtIn) & CheckTransform(const CMediaType *mtIn, const CMediaType *mtOut) functions looks as follows,
if (IsEqualGUID(*mtIn->Type(), MEDIATYPE_Video)) if (IsEqualGUID(*mtIn->Subtype(), MEDIASUBTYPE_RGB32)) { VIDEOINFOHEADER *pvi = (VIDEOINFOHEADER *)mtIn->Format(); return (pvi->bmiHeader.biBitCount == 32); }
Is there anything I have to change/add? Even any solution with RGB 24 bit is also fine. I appreciate any and all comments and suggestions. Thanks & Regards, Aniket A. Salunkhe -
Hi to all, I am creating a DirectShow filter, that will only read the RGB pixel (32 bit) from MPEG-2 input video source. I am connecting it after MPEG-2 Video Decoder as follows, MPEG-2 Video Decoder --> My Custom Filter --> Video Renderer I am receiving video size from My Custom Filter is 720x480, but actual video size if 720x576. Code within CheckInputType(const CMediaType *mtIn) & CheckTransform(const CMediaType *mtIn, const CMediaType *mtOut) functions looks as follows,
if (IsEqualGUID(*mtIn->Type(), MEDIATYPE_Video)) if (IsEqualGUID(*mtIn->Subtype(), MEDIASUBTYPE_RGB32)) { VIDEOINFOHEADER *pvi = (VIDEOINFOHEADER *)mtIn->Format(); return (pvi->bmiHeader.biBitCount == 32); }
Is there anything I have to change/add? Even any solution with RGB 24 bit is also fine. I appreciate any and all comments and suggestions. Thanks & Regards, Aniket A. SalunkheHi! Did you use GraphEdit to see what inputs-outputs your filter gets?
> The problem with computers is that they do what you tell them to do and not what you want them to do. < > Life: great graphics, but the gameplay sux. <
-
Hi! Did you use GraphEdit to see what inputs-outputs your filter gets?
> The problem with computers is that they do what you tell them to do and not what you want them to do. < > Life: great graphics, but the gameplay sux. <
Hi, First I am conecting as MPEG-2 Video Decoder --> My Custom Filter --> Video Renderer & run the graph Input Pin Properties of My Custom Filter Major Type : Video Sub Type : RGB32 Format : RGB 720x480, 32 bits Output Pin Properties of My Custom Filter Major Type : Video Sub Type : RGB32 Format : RGB 720x480, 32 bits And in output I get video cropped at bottom --------------------------- Then I am conecting as MPEG-2 Video Decoder --> Video Renderer & run the graph Input Pin Properties of Video Renderer Major Type : Video Sub Type : DXVA_ModeMPEG2_A Format : NV12 704x576, 12 bits Aspect Ration: 4x3 Interlace format: Interleaved Bob Only proper video output --------------------------- After that I am conecting as MPEG-2 Video Decoder --> My Custom Filter --> Video Renderer (again) & run the graph Input Pin Properties of My Custom Filter Major Type : Video Sub Type : RGB32 Format : RGB 704x576, 32 bits Output Pin Properties of My Custom Filter Major Type : Video Sub Type : RGB32 Format : RGB 704x576, 32 bits And in output I get am getting proper video
-
Hi, First I am conecting as MPEG-2 Video Decoder --> My Custom Filter --> Video Renderer & run the graph Input Pin Properties of My Custom Filter Major Type : Video Sub Type : RGB32 Format : RGB 720x480, 32 bits Output Pin Properties of My Custom Filter Major Type : Video Sub Type : RGB32 Format : RGB 720x480, 32 bits And in output I get video cropped at bottom --------------------------- Then I am conecting as MPEG-2 Video Decoder --> Video Renderer & run the graph Input Pin Properties of Video Renderer Major Type : Video Sub Type : DXVA_ModeMPEG2_A Format : NV12 704x576, 12 bits Aspect Ration: 4x3 Interlace format: Interleaved Bob Only proper video output --------------------------- After that I am conecting as MPEG-2 Video Decoder --> My Custom Filter --> Video Renderer (again) & run the graph Input Pin Properties of My Custom Filter Major Type : Video Sub Type : RGB32 Format : RGB 704x576, 32 bits Output Pin Properties of My Custom Filter Major Type : Video Sub Type : RGB32 Format : RGB 704x576, 32 bits And in output I get am getting proper video
Hmm, strange, and it's not just the height, if you check the width it also varies between 704 and 720. Try experimenting with a different filter to see how it behaves, for example try putting a color space converter filter between the renderer and the decompressor and see what formats that gets, maybe it can help finding out something...also try logging out what formats the mpg decompressor tries to feed your filter...currently i have no exact idea what the problem could be.
> The problem with computers is that they do what you tell them to do and not what you want them to do. < > Life: great graphics, but the gameplay sux. <
-
Hmm, strange, and it's not just the height, if you check the width it also varies between 704 and 720. Try experimenting with a different filter to see how it behaves, for example try putting a color space converter filter between the renderer and the decompressor and see what formats that gets, maybe it can help finding out something...also try logging out what formats the mpg decompressor tries to feed your filter...currently i have no exact idea what the problem could be.
> The problem with computers is that they do what you tell them to do and not what you want them to do. < > Life: great graphics, but the gameplay sux. <
Thanks for reply. Custom Filter with RGB24, a Color Space Converter filter gets added between custom filter & video renderer. While with RGB32, it is directly connecting to video renderer. I am using Elecard Video Decoder.
Code-o-mat wrote:
experimenting with a different filter to see how it behaves
I tried with different video deocders, but i m getting more issues with other deocders, like inverted video, green video, etc