how to force to use YUV instead of I420

how to force to use YUV instead of I420

Post by peggy8 » Wed, 20 Dec 2006 18:42:50


hi all,
I'm doing a program which capture video from camera. My camera supports
YUY2 and I420.

By default the camera choose I420 for the capture format. But there is
no MEDIASUBTYPE_I420 in dxshow. So I need to force it to use the other
YUV format (might be IYUV or YUY2)

Please guide me on how to do it.

Thanks.

-peggy
 
 
 

how to force to use YUV instead of I420

Post by peggy8 » Wed, 20 Dec 2006 19:09:27

my question is how to change the default format.
as for YUV camera the default format is I420.

 
 
 

how to force to use YUV instead of I420

Post by The March » Thu, 21 Dec 2006 00:14:19


Look at IAMStreamConfig in the SDK docs. You can also search for this
topic on Google Groups as it has come up many times.

--
Please read this before replying:
1. Dshow & posting help: http://www.yqcomputer.com/
2. Trim & respond inline (please don't top post or snip everything)
3. Benefit others: follow up if you are helped or you found a solution
 
 
 

how to force to use YUV instead of I420

Post by Chris P » Thu, 21 Dec 2006 02:50:35


Note that IYUV is synonymous with I420. Also any standard fourcc can be
made into a valid media type via a macro.

e.g.
DEFINE_GUID(MEDIASUBTYPE_I420, MAKEFOURCC('I','4','2','0'), 0x0000, 0x0010,
0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71);
or
DEFINE_GUID(MEDIASUBTYPE_I420, 0x30323449, 0x0000, 0x0010, 0x80, 0x00,
0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71);


I think there is actually a DirectShow macro for this but can't remember it
off hand.

--
http://www.yqcomputer.com/
http://www.yqcomputer.com/
 
 
 

how to force to use YUV instead of I420

Post by The March » Thu, 21 Dec 2006 03:25:00


Good point, I always forget this one.

--
Please read this before replying:
1. Dshow & posting help: http://www.yqcomputer.com/
2. Trim & respond inline (please don't top post or snip everything)
3. Benefit others: follow up if you are helped or you found a solution
 
 
 

how to force to use YUV instead of I420

Post by Alessandro » Thu, 21 Dec 2006 04:24:47

From: "Chris P."


FOURCCMap() in the BaseClasses. To avoid referencing the
BaseClasses and the hassle of DEFINE_GUID()/INITGUID, I
usually prefer to do it at runtime this way:

/// MEDIATYPE_Video == FOURCCMap('vids')
GUID fccmap = MEDIATYPE_Video;
fccmap.Data1 = *(DWORD*)"I420";


/// MEDIATYPE_Audio == FOURCCMap('auds')
GUID fccmap = MEDIATYPE_Audio;
fccmap.Data1 = (DWORD)WAVE_FORMAT_PCM;

Which however is not a good practice if the code is executed
a few million times :-)

--
// Alessandro Angeli
// MVP :: DirectShow / MediaFoundation
// mvpnews at riseoftheants dot com
// http://www.yqcomputer.com/