Wataru
Newbie
Karma: +0/-0
Posts: 6
|
 |
« on: October 06, 2008, 10:37:36 PM » |
|
Hey everyone,
Ok, I have a problem here that I'd love to hear some input on... my goal is to try and get a video (that is captured live from a web camera) compressed down as small as possible. Here are the requirements I have: video must be at least 800x600 with 30 fps, the file size has to be smaller than 10 mg, the movie length (captured) is 60 seconds, and it must also capture audio (voice testimonial).
So far the best I can do is a file size of about 31 mg using CyberLink Mpeg Encoder for Audio, CyberLink Mpeg Video Encoder, and CyberLink Mpeg Mux. Does anyone have a better idea? I'm using GraphEditPlus to generate the code (c#) and then setting the framerate, height, and width inside the code to 30 fps, 800 x 600.
Here's the code I use to set the resolution and frame-rate... (I suspect the problem is here...)
private void SetConfigParms(ICaptureGraphBuilder2 capGraph (capture graph), IBaseFilter capFilter (video graph), int iFrameRate, int iWidth, int iHeight) { int hr; object o; AMMediaType media;
// Find the stream config interface hr = capGraph.FindInterface( PinCategory.Capture, MediaType.Video, capFilter, typeof(IAMStreamConfig).GUID, out o); DsError.ThrowExceptionForHR(hr);
IAMStreamConfig videoStreamConfig = o as IAMStreamConfig; if (videoStreamConfig == null) { throw new Exception("Failed to get IAMStreamConfig"); }
// Get the existing format block hr = videoStreamConfig.GetFormat(out media); DsError.ThrowExceptionForHR(hr);
// copy out the videoinfoheader VideoInfoHeader v = new VideoInfoHeader(); Marshal.PtrToStructure(media.formatPtr, v);
// if overriding the framerate, set the frame rate if (iFrameRate > 0) { //v.AvgTimePerFrame = 10000000 / iFrameRate; }
// if overriding the width, set the width if (iWidth > 0) { v.BmiHeader.Width = iWidth; }
// if overriding the Height, set the Height if (iHeight > 0) { v.BmiHeader.Height = iHeight; }
// Copy the media structure back Marshal.StructureToPtr(v, media.formatPtr, false);
// Set the new format hr = videoStreamConfig.SetFormat(media); DsError.ThrowExceptionForHR(hr);
DsUtils.FreeAMMediaType(media); media = null; }
Any input will be greatly appreciated!!!! Thanks!!!
|