Question

I have a logitech c920 webcam that presents an encoded h264 capture pin (subtype: MEDIASUBTYPE_H264).

The h264 pin supports the following resolutions:

FORMAT_VideoInfo - subtype: MEDIASUBTYPE_H264 640x480 @ 30 fps  
FORMAT_VideoInfo - subtype: MEDIASUBTYPE_H264 160x90 @ 30 fps  
FORMAT_VideoInfo - subtype: MEDIASUBTYPE_H264 160x120 @ 30 fps  
FORMAT_VideoInfo - subtype: MEDIASUBTYPE_H264 176x144 @ 30 fps  
FORMAT_VideoInfo - subtype: MEDIASUBTYPE_H264 320x180 @ 30 fps  
FORMAT_VideoInfo - subtype: MEDIASUBTYPE_H264 320x240 @ 30 fps  
FORMAT_VideoInfo - subtype: MEDIASUBTYPE_H264 352x288 @ 30 fps  
FORMAT_VideoInfo - subtype: MEDIASUBTYPE_H264 432x240 @ 30 fps  
FORMAT_VideoInfo - subtype: MEDIASUBTYPE_H264 640x360 @ 30 fps  
FORMAT_VideoInfo - subtype: MEDIASUBTYPE_H264 800x448 @ 30 fps  
FORMAT_VideoInfo - subtype: MEDIASUBTYPE_H264 800x600 @ 30 fps  
FORMAT_VideoInfo - subtype: MEDIASUBTYPE_H264 864x480 @ 30 fps  
FORMAT_VideoInfo - subtype: MEDIASUBTYPE_H264 960x720 @ 30 fps  
FORMAT_VideoInfo - subtype: MEDIASUBTYPE_H264 1024x576 @ 30 fps  
FORMAT_VideoInfo - subtype: MEDIASUBTYPE_H264 1280x720 @ 30 fps  
FORMAT_VideoInfo - subtype: MEDIASUBTYPE_H264 1600x896 @ 30 fps  
FORMAT_VideoInfo - subtype: MEDIASUBTYPE_H264 1920x1080 @ 30 fps  

In my testing it always uses 3 Mbits regardless of the selected resolution. It is a bit too much, especially for the lower resolutions.

Any idea on how to programatically select the desired bitrate using directshow? Or maybe other API ?

Was it helpful?

Solution

From the Logitech support answer it follows that the encoding is 80/20 HW/SW and the bitrate (and GOP) cannot be controlled. However their bundled software obviously does that. Other than that, after some limit, there is a decrease in the bit rate, though it occurs at really low resolution/fps combinations:

Required bandwidth for size:  ( 1920 , 1080 )  @ 30  is 2.81771 Mbit 
Required bandwidth for size:  ( 1920 , 1080 )  @ 25  is 2.81672 Mbit 
Required bandwidth for size:  ( 1920 , 1080 )  @ 20  is 2.82701 Mbit 
Required bandwidth for size:  ( 1920 , 1080 )  @ 15  is 2.83327 Mbit 
Required bandwidth for size:  ( 1920 , 1080 )  @ 10  is 2.83594 Mbit 
Required bandwidth for size:  ( 1920 , 1080 )  @ 5  is 2.8431 Mbit 
Required bandwidth for size:  ( 1280 , 720 )  @ 30  is 2.82013 Mbit 
Required bandwidth for size:  ( 1280 , 720 )  @ 25  is 2.82436 Mbit 
Required bandwidth for size:  ( 1280 , 720 )  @ 20  is 2.83217 Mbit 
Required bandwidth for size:  ( 1280 , 720 )  @ 15  is 2.83696 Mbit 
Required bandwidth for size:  ( 1280 , 720 )  @ 10  is 2.83721 Mbit 
Required bandwidth for size:  ( 1280 , 720 )  @ 5  is 2.45272 Mbit 
Required bandwidth for size:  ( 864 , 480 )  @ 30  is 2.82089 Mbit 
Required bandwidth for size:  ( 864 , 480 )  @ 25  is 2.82313 Mbit 
Required bandwidth for size:  ( 864 , 480 )  @ 20  is 2.83131 Mbit 
Required bandwidth for size:  ( 864 , 480 )  @ 15  is 2.83343 Mbit 
Required bandwidth for size:  ( 864 , 480 )  @ 10  is 2.79526 Mbit 
Required bandwidth for size:  ( 864 , 480 )  @ 5  is 1.15564 Mbit 
Required bandwidth for size:  ( 320 , 180 )  @ 30  is 1.90123 Mbit 
Required bandwidth for size:  ( 320 , 180 )  @ 25  is 1.89367 Mbit 
Required bandwidth for size:  ( 320 , 180 )  @ 20  is 1.26006 Mbit 
Required bandwidth for size:  ( 320 , 180 )  @ 15  is 0.957935 Mbit 
Required bandwidth for size:  ( 320 , 180 )  @ 10  is 0.637158 Mbit 
Required bandwidth for size:  ( 320 , 180 )  @ 5  is 0.328456 Mbit

If you came up with the solution, please, share. Thanks!

OTHER TIPS

Query pin for IAMStreamConfig interface, get this list of formats via GetStreamCaps(), select the one you need, it will contain pointer pFormat to VIDEOINFO structure which contains dwBitRate field. Change this field to desired bitrate and call IAMStreamConfig::SetFormat with this new data.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top