Source change video solution from webcam - It's wrong???

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance

vietdoor_at_gmail.com
Date: 02/14/05


Date: 13 Feb 2005 23:05:19 -0800

I want to change width and height of Webcam for capturing to a video
file.But with below source, error is "This media type is not valid".

// ICaptureGraphBuilder2 *m_pBuilder;
// IAMStreamConfig *m_pVSC;
// IBaseFilter *m_pSrcFilter; // Filter is from Live Video
// int width, int height // 160 x 120 or 320 x 240

hr = m_pBuilder->FindInterface(&PIN_CATEGORY_CAPTURE,
&MEDIATYPE_Interleaved, m_pSrcFilter, IID_IAMStreamConfig, (void
**)&m_pVSC);

if (FAILED(hr))
{
  hr = m_pBuilder->FindInterface(&PIN_CATEGORY_CAPTURE,
&MEDIATYPE_Video, m_pSrcFilter, IID_IAMStreamConfig, (void **)&m_pVSC);
}

if(hr != NOERROR)
{
            // this means we can't set frame rate (non-DV only)
            ErrMsg(TEXT("Error %x: Cannot find
VCapture:IAMStreamConfig"), hr);
}
else
{
                        AM_MEDIA_TYPE *pmt;
                        hr = m_pVSC->GetFormat(&pmt);

                        // DV capture does not use a VIDEOINFOHEADER
                        if(hr == NOERROR)
                        {
                if(pmt->formattype == FORMAT_VideoInfo)
                                {
                    VIDEOINFOHEADER *pvi = (VIDEOINFOHEADER
*)pmt->pbFormat;

                                        pvi->bmiHeader.biWidth = width;
                                        pvi->bmiHeader.biHeight = height;
                                }

hr = m_pVSC->SetFormat(pmt);

-----------------------------------

Help me! Thanks



Relevant Pages

  • Problem with media types in a filter, HELP
    ... the video I see with the Video Render is very bad (I can't almost see ... I think that is because of the media type that the webcam ... maybe the webcam is in another format. ...
    (microsoft.public.win32.programmer.directx.video)
  • RE: Captured Video Distortion !!!
    ... I am capturing from a VHS VCR with the ... > I am brand new to trying to capture and edit video and photos. ... > installing the necessary updated drivers, ...
    (microsoft.public.windowsxp.moviemaker)
  • RE: Captured Video Distortion !!!
    ... I am using a Sony TRV480E Camcorder, ... I am capturing from a VHS VCR with the ... >> I am brand new to trying to capture and edit video and photos. ...
    (microsoft.public.windowsxp.moviemaker)
  • Re: simple webcam question -- urgent!
    ... video by this evening. ... type: v4l2 ... flags: overlay capture tuner ... depending on if your webcam uses YUYV, or MJPEG, or JPEG... ...
    (alt.os.linux)
  • RE: Captured Video Distortion !!!
    ... I am capturing from a VHS VCR with the ... >>> I am brand new to trying to capture and edit video and photos. ... >>> I bought this unit with the purpose of converting and editing VHS video ...
    (microsoft.public.windowsxp.moviemaker)