After seeing mention of FORMAT_UVCH264Video in the GDCL Mpeg-4 Multiplexor ReadMe and finding this commit https://github.com/cplussharp/graph-stu ... f3e57e5f7e
for GraphStudioNext, I decided to have play around with this myself and seem to have at least solved the issue of capturing H264 directly.
You can see the changes to dshow.c required here https://github.com/ltchuan/FFmpeg/commi ... 450ddb1781
. I've also uploaded binaries with these changes to https://github.com/ltchuan/FFmpeg/releases/tag/a0.1
just in case anyone wants try it.
Basically the issue is dshow in FFmpeg currently only looks for device capabilities that have format type FORMAT_VideoInfo or FORMAT_VideoInfo2 for their format block, otherwise it just ignores that capability. The format block of the C930e's H264 capabilities are of type FORMAT_UVCH264Video. This also explains why this isn't a problem for the C920 (with generic Microsoft drivers) because for this webcam, the H264 capabilities still use FORMAT_VideoInfo.
So supporting H264 from the C930e seems to just be a matter of making FFmpeg DirectShow recognise these capabilities and interpret them correctly. The existing dshow code for interpreting capabilities relies quite a bit on there being a BITMAPINFOHEADER structure though, which is present in both the VIDEOINFOHEADER and VIDEOINFOHEADER2 structures but doesn't exist in KS_H264VIDEOINFO (the format block structure associated with FORMAT_UVCH264Video).
So there is a bit of reworking needed rather than just adding FORMAT_UVCH264Video to the if else block. In my code changes, I tried to keep modifying the existing code to a minimum but there is probably a more logical way you can restructure things if you are willing to modify the existing code more.
Also the existing code gets the resolution and frame rate from the returned VIDEO_STREAM_CONFIG_CAPS structure but for H264 capabilities, this structure doesn't return useful information, it has a null GUID and always has a min and max size of 1920x1080 (at least for me). Instead, the KS_H264VIDEOINFO structure itself seems to contain the information on the width and height for these capabilities.
Lastly, the GUIDs for FORMAT_UVCH264Video and MEDIASUBTYPE_H264 as well as the typedef for the KS_H264VIDEOINFO structure currently seem not to be in the MinGW headers (I think they were added into the Windows SDK sometime around Windows 8). So I've added these to the dshow_capture.h header to allow compiling with MinGW.
One more thing I want to do is add the ability to specify a the H264 profile to capture. My C930e seems to list capabilities for both a Constrained Baseline Profile (0x4240, profile_idc 66 with constraint set 1 I think) as well as a Constrained High Profile (0x640C, profile_idc 100 with constraint set 4 and 5 it seems). The code in the current form will just capture the first one with the correct resolution it encounters, which for me is always the baseline profile.
After that I'll have a look at submitting this to FFmpeg or at least opening a ticket about it. I only have the barest idea of what I'm doing though so would be good if anyone here with more knowledge about things would take a look at the code changes and let me know if it is the sort of thing that is expected (and perhaps fix it up if it isn't).
Would also be good if anyone else with a C930e would try the changes and let me know if they work for them as well. As per earlier, the binaries are available at https://github.com/ltchuan/FFmpeg/releases/tag/a0.1
. The FFmpeg command to capture would be something along the lines of "ffmpeg -f dshow -video_size 1280x720 -framerate 30 -vcodec h264 -i video="Logitech Webcam C930e" -copyinkf -vcodec copy C930e_test.mkv".
PS - These changes only allow capture for the UVC 1.5 H264 stream. They do nothing for the MJPEG hack mentioned earlier in the thread or for SVC.