Tutorial :how to improve my code to make better video quality?


I am using the following code to leverage Windows Media Encoder to record screen. I am using Windows Vista, screen resolution 1024 × 768, 32-bit. My issue is, the video could be recorded successfully, but when I playback the recorded video, the quality of video is not very good -- e.g. characters are very obscure. I am wondering what are the parameters I should try to tune to get better quality of recorder video?

My code,

            static WMEncoder encoder = new WMEncoder();                IWMEncSourceGroup SrcGrp;              IWMEncSourceGroupCollection SrcGrpColl;              SrcGrpColl = encoder.SourceGroupCollection;              SrcGrp = (IWMEncSourceGroup)SrcGrpColl.Add("SG_1");                IWMEncVideoSource2 SrcVid;              SrcVid = (IWMEncVideoSource2)SrcGrp.AddSource(WMENC_SOURCE_TYPE.WMENC_VIDEO);              SrcVid.SetInput("ScreenCap://ScreenCapture1", "", "");              IWMEncFile File = encoder.File;              File.LocalFileName = "C:\\OutputFile.avi";                // Choose a profile from the collection.              IWMEncProfileCollection ProColl = encoder.ProfileCollection;              IWMEncProfile Pro;              for (int i = 0; i < ProColl.Count; i++)              {                  Pro = ProColl.Item(i);                  if (Pro.Name == "Windows Media Video 8 for Local Area Network (384 Kbps)")                  {                      SrcGrp.set_Profile(Pro);                      break;                  }              }            encoder.Start();  

thanks in advance, George


Video encoders use a certain kbit/second ratio to limit the size of the generated stream. The fewer kbits/sec the less detail you will get due to fewer coefficients from the DCT and bigger quantization values. In other words: the more kbits/sec you put into the video the more detail can be stored in the stream by the encoder.

Judging by your code you have chosen a profile which uses 384 kbit/s which is not very much for a 1024*768 video. You should try other profiles or set bitrate you want yourself.

Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Next Post »