如何提高视频质量?

发布于 2024-07-19 13:46:45 字数 1197 浏览 9 评论 0原文

我使用以下代码片段来录制屏幕,并且在大多数情况下录制的 wmv 文件足够清晰,但对于视频的某些部分来说,它不是很清晰(某些部分为灰色)。 我录制的是全屏模式的ppt。 我正在使用 Windows Media Encoder 9。

这是我的代码片段,

IWMEncSourceGroup SrcGrp;
IWMEncSourceGroupCollection SrcGrpColl;
SrcGrpColl = encoder.SourceGroupCollection;
SrcGrp = (IWMEncSourceGroup)SrcGrpColl.Add("SG_1");

IWMEncVideoSource2 SrcVid;
IWMEncSource SrcAud;
SrcVid = (IWMEncVideoSource2)SrcGrp.AddSource(WMENC_SOURCE_TYPE.WMENC_VIDEO);
SrcAud = SrcGrp.AddSource(WMENC_SOURCE_TYPE.WMENC_AUDIO);

SrcVid.SetInput("ScreenCap://ScreenCapture1", "", "");
SrcAud.SetInput("Device://Default_Audio_Device", "", "");

// Specify a file object in which to save encoded content.
IWMEncFile File = encoder.File;
string CurrentFileName = Guid.NewGuid().ToString();
File.LocalFileName = CurrentFileName;
CurrentFileName = File.LocalFileName;

// 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 == "Screen Video/Audio High (CBR)")
    {
        SrcGrp.set_Profile(Pro);
        break;
    }
}
encoder.Start();

提前致谢, 乔治

I am using the following code snippets to record screen, and in most situations recorded wmv file is clear enough, but for some part of video it is not very clear (grey color for some parts). What I record is ppt with full screen mode. I am using Windows Media Encoder 9.

Here is my code snippet,

IWMEncSourceGroup SrcGrp;
IWMEncSourceGroupCollection SrcGrpColl;
SrcGrpColl = encoder.SourceGroupCollection;
SrcGrp = (IWMEncSourceGroup)SrcGrpColl.Add("SG_1");

IWMEncVideoSource2 SrcVid;
IWMEncSource SrcAud;
SrcVid = (IWMEncVideoSource2)SrcGrp.AddSource(WMENC_SOURCE_TYPE.WMENC_VIDEO);
SrcAud = SrcGrp.AddSource(WMENC_SOURCE_TYPE.WMENC_AUDIO);

SrcVid.SetInput("ScreenCap://ScreenCapture1", "", "");
SrcAud.SetInput("Device://Default_Audio_Device", "", "");

// Specify a file object in which to save encoded content.
IWMEncFile File = encoder.File;
string CurrentFileName = Guid.NewGuid().ToString();
File.LocalFileName = CurrentFileName;
CurrentFileName = File.LocalFileName;

// 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 == "Screen Video/Audio High (CBR)")
    {
        SrcGrp.set_Profile(Pro);
        break;
    }
}
encoder.Start();

thanks in advance,
George

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

拿命拼未来 2024-07-26 13:46:45

“屏幕视频/音频媒体 (CBR)”
它解决了我的问题

"Screen Video/Audio Medium (CBR)"
it solved my problem

轻拂→两袖风尘 2024-07-26 13:46:45

我猜想这是您的编码器配置文件或设置的问题,而不是代码的问题。 如果您在 WME9 中使用默认的“屏幕视频/音频高 (CBR)”配置文件,则它使用的视频比特率为 250Kbps,这是相当低的。 我建议在 Windows Media Encoder 配置文件编辑器实用程序中创建自定义配置文件。 像这样的东西:

awesomesc.prx

名称:很棒的屏幕配置文件

音频:WMA 9.2 CBR(32kbps、44kHz、单声道 CBR)

视频:WMV 9 屏幕质量 VBR(视频大小与视频输入相同,帧速率 10fps,关键帧间隔 3 秒,视频质量 90)

然后只需更改代码以匹配自定义配置文件的名称。

if (Pro.Name == "Awesome Screen Profile")

编码器设置将需要更长的时间才能完成,但如果您没有更改默认值,那么应该没问题。

基于质量的 VBR 算法可能非常惊人,并且可能会产生令人惊讶的低平均比特率,但如果 VBR 无法满足您的需求,您可以使用 Windows Media Encoder Profile Editor 实用程序导入 schia。 prx 配置文件,并调整设置以找到更高的 CBR 比特率,从而产生可接受的质量。

I would guess that it's a problem with your encoder profile or settings, and not a problem with the code. If you're using the default "Screen Video/Audio High (CBR)" profile in WME9, it's using a video bitrate of 250Kbps, which is pretty low. I'd suggest creating a custom profile in the Windows Media Encoder Profile Editor Utility. Something like this:

awesomesc.prx

Name: Awesome Screen Profile

Audio: WMA 9.2 CBR (32kbps, 44kHz, mono CBR)

Video: WMV 9 Screen Quality VBR (Video size Same as video input, Frame rate 10fps, Key frame interval 3sec, Video quality 90)

Then just change the code to match the custom profile's name.

if (Pro.Name == "Awesome Screen Profile")

The encoder settings would take a much longer post to go through, but if you have not changed them from the defaults, you should be OK.

The Quality-based VBR algorithm can be pretty amazing, and will likely produce a surprisingly low average bitrate, but if VBR won't work for your needs, you can use the Windows Media Encoder Profile Editor utility to import the schia.prx profile that you're using and tweak the settings to find a higher CBR bitrate that produces acceptable quality.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文