Windows-Mobile Directshow:指定 WMV 视频捕获的比特率/质量

发布于 2024-08-20 16:16:31 字数 1080 浏览 12 评论 0原文

我对此感到困惑,我真的希望有人能指出我正确的方向。

我目前正在 Windows Mobile 中捕获视频并使用 WMV 9 DMO (CLSID_CWMV9EncMediaObject) 对其进行编码。这一切都运行良好,但输出视频的比特率太高,导致视频文件对于我的需要来说太大了。

最终,我的目标是从我的 C++ 代码中模仿 Microsoft 的相机捕获对话框在“消息传递”质量模式 (64kbps) 下输出的视频设置。目前,我的代码正在输出比特率为 352kbps 的 WMV 文件。

我能找到的使用 WMV9 DMO 指定捕获比特率的唯一示例是

更新:在Windows Mobile中,我能找到的最接近的与比特率相同的编解码器属性是“g_wszWMVCVBRQuality”。 Microsoft 的此属性文档非常令人困惑我:基本上似乎是说数字越高,质量越高,但它绝对没有对每个数字的具体情况进行解释。当我尝试通过 WMV9 DMO 的属性包将此属性设置为“1”之类的值时,遇到了 -2147467259(未知)错误。

总结一下:在 Windows Mobile 平台上指定通过 directshow (wmv9) 捕获的视频的比特率/质量的基本策略是什么? 我听说过(或想知道)以下方法:

  1. 使用 propertybag 更改编码器 DMO 对应于比特率/质量的属性(当前失败)
  2. 创建您自己的自定义转码器/编码器来指定它。这似乎没有必要,因为 WMV 编码器工作得很好——只是比特率太高了。
  3. VIDEOINFOHEADER 有一个比特率属性,但我怀疑在这里指定新设置不会改变实际的编码过程,因为我认为文件属性在编码之后才会发挥作用。

有什么建议吗?

附: 我会发布具体的源代码,但在这一点上,它可能会带来更多的困惑,而不是有帮助,因为我在如何做到这一点上陷入了困境。此时,我只是想验证总体策略。

谢谢!

I'm stumped on this, and I'm really hoping someone could point me in the right direction.

I'm currently capturing video in Windows Mobile and encoding it using the WMV 9 DMO (CLSID_CWMV9EncMediaObject). That all works well enough, but the output video's bitrate is too high, resulting in a video file that's much too large for my needs.

Ultimately, my goal is to mimic the video settings that Microsoft's Camera Capture Dialog outputs in the "messaging" quality mode (64kbps) from my C++ code. Currently, my code's outputting a WMV file with a bitrate of 352kbps.

The only example I could find of specifying the capture bitrate with a WMV9 DMO was this. The idea in that code was basically to use a propertybag to write a bitrate to a property of the DMO.

Update: In windows mobile, the closest codec property I can find that seems to equate to the bitrate is "g_wszWMVCVBRQuality". Microsoft's documentation of this property is extremely confusing to me: It basically seems to say that a higher number equates to a higher quality, but it gives absolutely no explanation of the specifics for each number. When I attempt to set this property to value like "1" via a propertybag for the WMV9 DMO, I run into a -2147467259 (unknown) error.

To summarize: What is the basic strategy to specify the bitrate/quality of a video being captured via directshow (wmv9) on a windows mobile platform?
I've heard (or wondered about) the following methods:

  1. Use the propertybag to change the encoder DMO's property that corresponds to bitrate/quality (currently failing)
  2. Create your own custom transcoder/encoder to specify it. This seems unnecessary since the WMV encoder works well enough- it's just at too high a bitrate.
  3. The VIDEOINFOHEADER has a bitrate property, but I suspect that specifying new settings here will do nothing to alter the actual encoding process since I wouldn't think file attributes would come into play until after the encoding.

Any suggestions?

PS:
I would post specific source code, but at this point it may confuse more than it helps since I'm floundering so much on how to do this. At this point, I'm just trying to validate the general strategy.

THANKS!

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

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

发布评论

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

评论(1

请恋爱 2024-08-27 16:16:31

好的,我在设置 propertybag 值(方法 1)时解决了错误,现在我可以以编程方式设置视频“质量”,不会发生任何事件。

我做的事情没有按顺序进行。如果您在将 WMV9 DMO 编码器添加到图形但调用渲染流之前。使用 propertybag 和 VARIANT 来更改 DMO(同样,我使用 CLSID_DMOWrapperFilter)g_wszWMVCVBRQuality 属性。对于 Windows Mobile,该全局变量在 Windows Mobile 6 SDK 的 wmcodecstrs.h 文件中定义。

基本上,您设置的数字越低,质量越差。就像 MS 文档所说的那样; )
例如,将其设置为 1 会产生看起来非常糟糕的视频。

顺便说一句,我的 dshow 代码视频和 CCD 生成的视频之间的大小差异不是由于视频源的比特率造成的,而是由于插入视频文件的音频流造成的。对于 VLC 媒体播放器,CCD 的视频是 8000hz 的 8 位音频,而我的代码的视频是 22050hz 的 16 位音频。尺寸差别大!现在我必须弄清楚如何降低音频设置... >: (

Ok, I got around the error when setting the propertybag value (method 1), and I can now set the video "quality" programmatically without incident.

I was doing things out of order. You can change the settings successfully in the manner I described (and linked to) if you do it after adding the WMV9 DMO encoder to the graph but before calling renderstream. Use a propertybag along with a VARIANT to make the changes to the DMO's (again, I'm using CLSID_DMOWrapperFilter) g_wszWMVCVBRQuality property. For Windows Mobile, that global is defined in the Windows Mobile 6 SDK's wmcodecstrs.h file.

Basically, the lower the number you set it to, the worse the quality. Just like the MS docs said ; )
Setting it to 1, for instance, produces video that looks absolutely terrible.

On a side note, the size difference between my dshow code videos and the CCD generated videos was not due to the video feed's bitrate, but to the audio stream that was getting plumbed into the video file. Per VLC Media Player, the CCD's video was 8 bit audio at 8000hz, while my code's video had 16 bit audio at 22050hz. Big size difference! Now I've just got to figure out how to lower the audio settings... >: (

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