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");
DsError.ThrowExceptionForHR(hr);
// 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);
DsError.ThrowExceptionForHR(hr);
// Now set the capture and still pins (from the splitter)
previewPin = DsFindPin.ByName(iSmartTee, "Preview");
capturePin = DsFindPin.ByName(iSmartTee, "Capture");
m_FilterGraph.Render(previewPin);
x264Filter = new XVID() as IBaseFilter;
hr = m_FilterGraph.AddFilter(x264Filter, "x264 encoder");
DsError.ThrowExceptionForHR(hr);
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");
DsError.ThrowExceptionForHR(hr);
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");
DsError.ThrowExceptionForHR(hr);
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);
DsError.ThrowExceptionForHR(hr);
hr = m_FilterGraph.Connect(x264Out, aviIn);
DsError.ThrowExceptionForHR(hr);
hr = m_FilterGraph.Connect(aviOut, fileWriterIn);
DsError.ThrowExceptionForHR(hr);
ConfigVideoWindow(hControl);
Thanks in advance
+ Reply to Thread
Results 1 to 2 of 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.
Similar Threads
-
adobe premiere - mpeg2 color shift in reds & distortion on export
By diamenz in forum Video ConversionReplies: 4Last Post: 7th Mar 2020, 13:03 -
Trying to use a MiniDV camera for pass-through capture....
By gotdurt in forum Capturing and VCRReplies: 4Last Post: 20th Oct 2017, 12:23 -
Any capture software with creating own color profiles?
By MIRKOSOFT in forum Capturing and VCRReplies: 0Last Post: 15th Sep 2017, 08:37 -
PAL tape capture - color issue
By nesburf in forum Capturing and VCRReplies: 3Last Post: 3rd Mar 2017, 11:41 -
Which device can capture component video in 10bit 4:2:2 color?
By digicube in forum Capturing and VCRReplies: 11Last Post: 30th Oct 2016, 13:08