Infognition forum
August 01, 2010, 07:05:15 AM *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
News: Last GraphEditPlus version: 1.4.0   Last Video Enhancer version: 1.9.3
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: Trying to compress video while maintaining highest quality...  (Read 900 times)
Wataru
Newbie
*

Karma: +0/-0
Posts: 6


View Profile
« 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!!!
Logged
Dee Mon
Administrator
Sr. Member
*****

Karma: +7/-0
Posts: 271



View Profile WWW
« Reply #1 on: October 07, 2008, 07:34:11 AM »

So you want to compress 800x600x30 to just 1,2 MBit/s. What version of MPEG does Cyberlink Mpeg Encoder encode to? If it's MPEG2, then it might be impossible to compress to this size (I'm not absolutely sure, but certainly there are some lower limits for MPEG2 compression).

I've worked a few years making software for TV, and there they have similar resolution (little lower actually) and framerate video compressed with MJPEG at 40 MBit/s or with DV at 25 MBit/s. This is a nice TV quality.

In your place I would take an 800x600x30 video with a high bitrate (ideally captured and compressed with a lossless codec such as Lagarith) and then tried to compress it in VirtualDub with different codecs setting bitrate to desired 1200 KBit/s. MPEG4 codecs like DivX and XviD would probably succeed with compression, but the quality might not be very good.
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.5 | SMF © 2006-2008, Simple Machines LLC Valid XHTML 1.0! Valid CSS!