views:

410

answers:

1

Hi- 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!

A: 

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... >: (

Landstander