Friday, March 19, 2010 2:48 PM
On my application I use IAMStreamConfig to set stream resolution. I get the interface from the output pin of the source and then set BmiHeader.Width and BmiHeader.Height.
This worked fine up until now but we got new cameras shipped - Microsoft LifeCam Cinema. So far I haven't managed to make them generate a stream in a resolution other than 640x480. I was trying to force 320x240, which didn't work, and then tried other resolutions, which didn't work either.
I tried going through all the filters in the graph with IEnumFilters but I didn't find the IAMStreamConfig interface on another pin.
So is there another way to change the stream resolution?
Thanks for the suggestions!
Friday, March 19, 2010 4:39 PMIt is working for us. Are you enumerating all the formats available via IAMStreamConfig?
Monday, March 22, 2010 6:00 PM
The first time I saw the reply I didn't realize its implications. Now I took a second look and understood the suggestion.
So, no, I haven't checked the formats available (I guess this means enumerating what is returned by
Tomorrow I'll see what does GetStreamCaps return. Thanks for the suggestion!
Tuesday, March 23, 2010 8:38 AM
A word of warning - with more modern cards I've found IAMStreamConfig::GetStreamCaps unreliable and doesn't always give you all the available modes :-
Indeed, I've even had situations where the capabilities that are returned do not include the resolution that the capture device was starting up with by default .
Wednesday, March 31, 2010 11:21 AM
Had to fix some urgent issues on other projects and now I'm back to the frontline of the battle to force the LifeCam Cinema to record on 320x240.
I tried enumerating the capabilities returned by GetStreamCaps - I get 32 results with various resolutions through both FORMAT_VideoInfo and FORMAT_VideoInfo2. I tried setting various options with SetFormat using both structures - the videos were consistently recorder on 640x480.
What I am doing is getting the VideoInfoHeader (or VideoInfoHeader2) through the pbFormat of the AM_MEDIA_TYPE returned by IAMStreamConfig.GetFormat, changing the values and then passing back to SetFormat. As I understand from Jon's link - this should be the "old" way, while the new way is described as "forcing the AM_MEDIA_TYPE of the pin". Can anyone shed some light on how to do this?
Wednesday, March 31, 2010 7:32 PM
What settings are you trying to change between the calls to GetFormat() and SetFormat()? If you set up a format structure incorrectly then the call to SetFormat will fail. If the setting call is successful then calling GetFormat() again should return the new setting and it will also show up as the first format returned via IPin::EnumMediaTypes(). In the case of the LifeCam the currently preferred format will be the only format returned.
Thursday, April 01, 2010 9:48 AM
At first I was setting the following properties:
After the call to setFormat I call getFormat again, the resolution is unchanged (640x480), while the bitrate value was accepted - I was testing with 1000000 (10 fps) and the value I got after setFormat was again 1000000. Before the call the value was 333333 (30 fps)
Indeed, after configuration the pin returns just one media type, with the same params - 640x480, 1000000 frame delay.
I tried setting just the resolution, without assigning values to the frame delay and BPP - nothing was changed in this case.
Thursday, April 01, 2010 3:25 PMYou should be calling SetFormat() with the complete AM_MEDIA_TYPE you receive from the call to GetStreamCaps() that matches the desired resolution. I.e. iterate through the AM_MEDIA_TYPE's of GetStreamCaps until the resolution matches, don't modify the media type with the exception of the VIDEOINFOHEADER AvgTimePerFrame and make sure that the modification conforms with the values specified in VIDEO_STREAM_CONFIG_CAPS MinFrameInterval, MaxFrameInterval.
- Marked As Answer by The March HareModerator Thursday, April 08, 2010 1:27 PM