VideoHelp Forum

Try DVDFab and download streaming video, copy, convert or make Blu-rays,DVDs! Download free trial !
+ Reply to Thread
Results 1 to 2 of 2
  1. Hi all,

    I capture from USB camera and encode with xvid codec then use avi mux into file, when I capture in graphEdit, it's ok, but when I capture in my program, the captured file has color distortion, anyone know the reason?

    [Attachment 53514 - Click to enlarge]

    IPin pRaw = null;
    IPin pSmart = null;

    // Add a splitter
    IBaseFilter iSmartTee = (IBaseFilter)new SmartTee();

    hr = m_FilterGraph.AddFilter(iSmartTee, "SmartTee");

    // Find the find the capture pin from the video device and the
    // input pin for the splitter, and connnect them
    pRaw = DsFindPin.ByCategory(capFilter, PinCategory.Capture, 0);
    pSmart = DsFindPin.ByDirection(iSmartTee, PinDirection.Input, 0);

    hr = m_FilterGraph.Connect(pRaw, pSmart);

    // Now set the capture and still pins (from the splitter)
    previewPin = DsFindPin.ByName(iSmartTee, "Preview");
    capturePin = DsFindPin.ByName(iSmartTee, "Capture");


    x264Filter = new XVID() as IBaseFilter;
    hr = m_FilterGraph.AddFilter(x264Filter, "x264 encoder");
    x264In = DsFindPin.ByDirection(x264Filter, PinDirection.Input, 0);
    x264Out = DsFindPin.ByDirection(x264Filter, PinDirection.Output, 0);

    aviMux = new AVIMUXFILTER() as IBaseFilter;
    hr = m_FilterGraph.AddFilter(aviMux, "avi mux");
    aviIn = DsFindPin.ByDirection(aviMux, PinDirection.Input, 0);
    aviOut = DsFindPin.ByDirection(aviMux, PinDirection.Output, 0);

    fileWriter = new FileWriter() as IBaseFilter;
    IFileSinkFilter fileSinkFilter = fileWriter as IFileSinkFilter;
    hr = m_FilterGraph.AddFilter(fileWriter, "file writer");
    AMMediaType media = new AMMediaType();
    media.majorType = MediaType.Stream;
    media.subType = MediaSubType.Avi;
    fileSinkFilter.SetFileName("123.avi", media);
    fileWriterIn = DsFindPin.ByDirection(fileWriter, PinDirection.Input, 0);

    hr = m_FilterGraph.Connect(capturePin, x264In);

    hr = m_FilterGraph.Connect(x264Out, aviIn);

    hr = m_FilterGraph.Connect(aviOut, fileWriterIn);


    Thanks in advance
    Quote Quote  
  2. Is this a webcam or some kind of composite capture device. That chroma noise looks like what you get from composite video with high frequency detail. If the video is supposed to be all greyscale you could always force Xvid to encode in greyscale mode.
    Quote Quote  

Similar Threads