如何提高我的代码做出更好的视频质量? [英] how to improve my code to make better video quality?
问题描述
我使用下面的代码利用Windows Media编码器,记录屏幕。我使用的是Windows Vista,屏幕分辨率1024×768,32位。我的问题是,视频可以成功地记录下来,但是当我播放录制的视频,视频的质量不是很好 - 例如人物都非常模糊。我想知道什么是我应该试着调整获得记录的视频质量更好的参数?
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?
我的代码,
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
推荐答案
视频编码器使用某一千比特/秒的比率,以限制所产生的流的大小。的千位较少/秒的较少细节,你会得到由于从DCT更少系数和更大的量化值。换句话说:越千比特/秒的你放入更多细节可以存储由编码器的数据流的视频
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.
由代码判断已选择一个简介它使用384 kbit / s的这是不是很为1024 * 768的视频。你应该尝试你想自己的其他配置文件或设置的比特率。
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.
这篇关于如何提高我的代码做出更好的视频质量?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!