问题
I am capturing a video using DirectShow Library (.NET), I have an analog device that outputs video through BNC, I connected it to a FrameGrabber hardware (http://www.videohome.com.tw/eng/products-detail.php?p_id=72&level1_id=18) connecting through USB to my computer, I was told that the analog device outputs the video at 720x576, however I get the video at 640x480, at the site it says the FrameGrabber does support 720x576.
For the purpose of simplicity, I tried to do what's described next in the DxLogo sample (I am using something a bit more custom, not really sure why now - may change to use the Capture from the DxLogo) and I get the same result as my program would, just thought it would be a better code reference.
I sent the Capture class to display in 720 x 576, it goes in and does SetFormat on IAMStreamConfig, which returns 0 (success), however when the RenderStream method is called, it returns: -2147024809 and fails. I couldn't find too much information on why that happens.
In my other code, I used GetNumberOfCapabilities and when going over them using GetStreamCaps I found one that is 720x576, I did SetFormat to the IAMStreamConfig using it and it succeeded, but got the same from RenderStream.
回答1:
The current/default capture mode is 640x480 and without changing it you capture video and you get it 640x480. So you need to change capture mode using IAMStreamConfig::SetFormat to get 720x576, and it seems you are trying it out but it also looks like you pick some format advertised by frame grabber driver and it was not accepted further. You need to inspect the format (media type details), perhaps something is wrong there (esp. it's indicating interlaced content), or just build your own proper media type and pass it with IAMStreamConfig::SetFormat
call.
来源:https://stackoverflow.com/questions/30346955/changing-sampled-video-size