DirectShow Capture support for C930e webcam

Announcements made by users.
rogerdpack
Posts: 1876
Joined: Fri Aug 05, 2011 9:56 pm

Re: DirectShow Capture support for C930e webcam

Post by rogerdpack » Sun Jul 19, 2015 2:31 am

sambul92 wrote:
rogerdpack wrote:So basically it doesn't advertise "normal" h264 media type, only mjpg?
In this regard C930e is similar to C920 that also doesn't advertise much formats for Capture 1 pin, yet ffmpeg was updated to list whatever it streams from that pin properly. :) Its interesting that modern UI Windows Camera App can record that, but no other Windows package.

Also C930e advertises MJPEG streams from Pin0 with encapsulated H264 content probably starting at certain higher resolutions & fps, and pure MJPG at lower fps. The guvcview author mentioned on its forum he amended ffmpeg code to properly list as H264 and capture that MJPEG content to file, not sure MP4 or MKV. Is it possible to add the same capability to ffmpeg dshow? C930e is now one of the most popular webcams, would be nice to have it supported.
Could you ask him for a patch/diff for me?

dalbani
Posts: 5
Joined: Wed Jul 08, 2015 6:18 pm

Re: DirectShow Capture support for C930e webcam

Post by dalbani » Sun Jul 19, 2015 10:14 am

Hello,
sambul92 wrote:Can you add Audio Capture filter in GraphStudioNext, and see what pins & formats does this webcam offer? Is it capable of streaming AAC, or only PCM? Don't forget to enable its Mic in Windows Sound Applet.
Using GraphStudioNext again, I did not see any reference to AAC, but only PCM.
sambul92 wrote:Also, pls run this command and post ffmpeg output and recorded file codecs info:

Code: Select all

ffmpeg -s 1920x1080 -framerate 30 -rtbufsize 100MB -video_pin_name 1 -f dshow -vcodec h264 -acodec aac -i video="Logitech Webcam C930e":audio="Microphone (2- Logitech Webcam C930e)" -copyinkf -c copy K:\Video\C930e.mp4
This is the error I got:

Code: Select all

[dshow @ 0000000002f76aa0] Could not set video options
video=Logitech Webcam C930e:audio=Microphone (2- Logitech Webcam C930e): Input/output error
sambul92 wrote: Another good test would be capturing its Graph in GraphStudioNext with DirectShowSpy, while recording its 1080P @ 30fps footage with Windows Camera App or streaming it with latest Skype. It'll show what DS filters & C930e pins & streams are used by WCA.
How can I do that in GraphStudioNext? Could you explain the steps, thanks.
Attachments
Screenshot (5).png

rogerdpack
Posts: 1876
Joined: Fri Aug 05, 2011 9:56 pm

Re: DirectShow Capture support for C930e webcam

Post by rogerdpack » Wed Jul 22, 2015 5:28 pm

dalbani wrote:Hello,
sambul92 wrote:Can you add Audio Capture filter in GraphStudioNext, and see what pins & formats does this webcam offer? Is it capable of streaming AAC, or only PCM? Don't forget to enable its Mic in Windows Sound Applet.
Using GraphStudioNext again, I did not see any reference to AAC, but only PCM.
sambul92 wrote:Also, pls run this command and post ffmpeg output and recorded file codecs info:

Code: Select all

ffmpeg -s 1920x1080 -framerate 30 -rtbufsize 100MB -video_pin_name 1 -f dshow -vcodec h264 -acodec aac -i video="Logitech Webcam C930e":audio="Microphone (2- Logitech Webcam C930e)" -copyinkf -c copy K:\Video\C930e.mp4
what about without -vcodec h264?
Maybe if I had access (or remote access) to one of these...

dalbani
Posts: 5
Joined: Wed Jul 08, 2015 6:18 pm

Re: DirectShow Capture support for C930e webcam

Post by dalbani » Sat Sep 05, 2015 12:03 pm

rogerdpack wrote: what about without -vcodec h264?
Maybe if I had access (or remote access) to one of these...
Sorry for getting back to you so late, I've moved to a new country lately and started a new job...

Regarding the omitted "-vcodec h264" test, no, I get the same error.

As you mentioned, I think the only solution to go forward is to give you a remote access to the camera.
I'm still waiting for my cable Internet access at home but it should be setup in a few days.

@rogerdpack, are you still interested?

rogerdpack
Posts: 1876
Joined: Fri Aug 05, 2011 9:56 pm

Re: DirectShow Capture support for C930e webcam

Post by rogerdpack » Wed Sep 09, 2015 5:19 pm

It would be interesting to at least look at...

Someonerctm
Posts: 2
Joined: Fri Dec 07, 2018 6:08 am

Re: DirectShow Capture support for C930e webcam

Post by Someonerctm » Fri Dec 07, 2018 3:30 pm

rogerdpack wrote:
Wed Sep 09, 2015 5:19 pm
It would be interesting to at least look at...
Apologies for reviving this very old thread but is there still any interest in taking a look at this?
I can provide remote access to one of these if needed.

The errors when trying to capture H264 appear to be still the same with the current version as earlier in the thread (errors included below).

I've managed to capture H264 directly from the C930e using the attached graph (image) so I'm wondering if the only issue is that ffmpeg doesn't recognise the capabilities in Pin 1 as H264 for some reason?
Sample video: c930 test with audio 20181208.mp4.

c930 graph 2.png
c930 graph 2.png (43.07 KiB) Viewed 2489 times


The graph was using capability 63 from the second capture pin as shown below (Full DirectShowCaptureCapabilities output).

Code: Select all

#### Capability: 63
 
 * `AM_MEDIA_TYPE`:
  * Data: `76 69 64 73 00 00 10 00 80 00 00 AA 00 38 9B 71 48 32 36 34 00 00 10 00 80 00 00 AA 00 38 9B 71 00 00 00 00 00 00 00 00 00 00 00 00 05 BE 17 20 29 66 48 42 AA ED 7E 1A 47 BC 9B 9C 00 00 00 00 00 00 00 00 00 00 00 00 54 00 00 00 00 00 00 00 40 E7 63 87 2F 02 00 00`
  * Format Data: `00 05 D0 02 01 00 01 00 0C 64 28 00 00 00 00 00 03 00 00 00 28 00 00 00 01 00 00 00 00 00 00 00 15 16 05 00 01 0E 0A 03 00 0F F5 00 00 00 00 00 00 00 F5 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00`
  * `.subtype`: `FourCC H264`
  * `.bFixedSizeSamples`: `0`
  * `.bTemporalCompression`: `0`
  * `.lSampleSize`: `0`
  * `.cbFormat`: `84`
  * `KS_H264VIDEOINFO`:
   * `.wWidth`: `1280`
   * `.wHeight`: `720`
   * `.wSARwidth`: `1`
   * `.wSARheight`: `1`
   * `.wProfile`: `0x640C` // High Profile + 0x0C
   * `.bLevelIDC`: `40` // 4.0
   * `.wConstrainedToolset`: `0`
   * `.bmSupportedUsages`: `0x00000003`
   * `.bmCapabilities`: `0x0028`
   * `.bmSVCCapabilities`: `0x00000001`
   * `.bmMVCCapabilities`: `0x00000000`
   * `.dwFrameInterval`: `33 3333`
   * `.bMaxCodecConfigDelay`: `0x01`
   * `.bmSupportedSliceModes`: `0x0E` // Target Slice Size | Number of Slices per Frame | Number of Macroblocks per Slice
   * `.bmSupportedSyncFrameTypes`: `0x0A`
   * `.bResolutionScaling`: `0x03`
   * `.bSimulcastSupport`: `0`
   * `.bmSupportedRateControlModes`: `0x0F`
   * `.wMaxMBperSecOneResolutionNoScalability`: `245`
   * `.wMaxMBperSecTwoResolutionsNoScalability`: `0`
   * `.wMaxMBperSecThreeResolutionsNoScalability`: `0`
   * `.wMaxMBperSecFourResolutionsNoScalability`: `0`
   * `.wMaxMBperSecOneResolutionTemporalScalability`: `245`
   * `.wMaxMBperSecTwoResolutionsTemporalScalablility`: `0`
   * `.wMaxMBperSecThreeResolutionsTemporalScalability`: `0`
   * `.wMaxMBperSecFourResolutionsTemporalScalability`: `0`
   * `.wMaxMBperSecOneResolutionTemporalQualityScalability`: `0`
   * `.wMaxMBperSecTwoResolutionsTemporalQualityScalability`: `0`
   * `.wMaxMBperSecThreeResolutionsTemporalQualityScalablity`: `0`
   * `.wMaxMBperSecFourResolutionsTemporalQualityScalability`: `0`
   * `.wMaxMBperSecOneResolutionTemporalSpatialScalability`: `0`
   * `.wMaxMBperSecTwoResolutionsTemporalSpatialScalability`: `0`
   * `.wMaxMBperSecThreeResolutionsTemporalSpatialScalablity`: `0`
   * `.wMaxMBperSecFourResolutionsTemporalSpatialScalability`: `0`
   * `.wMaxMBperSecOneResolutionFullScalability`: `0`
   * `.wMaxMBperSecTwoResolutionsFullScalability`: `0`
   * `.wMaxMBperSecThreeResolutionsFullScalability`: `0`
   * `.wMaxMBperSecFourResolutionsFullScalability`: `0`
 * `VIDEO_STREAM_CONFIG_CAPS`:
  * Data: `00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 80 07 00 00 38 04 00 00 80 07 00 00 38 04 00 00 80 07 00 00 38 04 00 00 01 00 00 00 01 00 00 00 01 00 00 00 01 00 00 00 80 07 00 00 38 04 00 00 80 07 00 00 38 04 00 00 01 00 00 00 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 15 16 05 00 00 00 00 00 80 84 1E 00 00 00 00 00 00 40 E3 09 00 80 53 3B`
  * `.guid`: `{00000000-0000-0000-0000-000000000000}`
  * `.VideoStandard`: `0`
  * `.InputSize`: `1920` x `1080`
  * `.MinCroppingSize`: `1920` x `1080`
  * `.MaxCroppingSize`: `1920` x `1080`
  * `.CropGranularityX`: `1`
  * `.CropAlignX`: `1`
  * `.CropAlignY`: `1`
  * `.MinOutputSize`: `1920` x `1080`
  * `.MaxOutputSize`: `1920` x `1080`
  * `.OutputGranularityX`: `1`
  * `.OutputGranularityY`: `1`
  * `.StretchTapsX`: `0`
  * `.StretchTapsY`: `0`
  * `.ShrinkTapsX`: `0`
  * `.ShrinkTapsY`: `0`
  * `.MinFrameInterval`: `33 3333`
  * `.MaxFrameInterval`: `200 0000`
  * `.MinBitsPerSecond`: `165,888,000`
  * `.MaxBitsPerSecond`: `995,328,000`
  * `IAMVideoControl` Frame Rates: 30.00, 24.00, 20.00, 15.00, 10.00, 7.50, 5.00

Errors in ffmpeg:
ffmpeg -f dshow -video_size 1280x720 -framerate 30 -vcodec h264 -i video="Logitech Webcam C930e" -copyinkf -c copy C:\Temp\C930e_test_20181208.mp4
gives
[dshow @ 0000027c15a1b580] Could not set video options
video=Logitech Webcam C930e: I/O error

And
ffmpeg -f dshow -video_pin_name 1 -i video="Logitech Webcam C930e" -copyinkf -c copy C:\Temp\C930e_test_20181208.mp4
gives
[dshow @ 0000022212cfaa40] Could not get media type.
video=Logitech Webcam C930e: I/O error

Output with loglevel debug:

Code: Select all

ffmpeg version 4.1 Copyright (c) 2000-2018 the FFmpeg developers
built with gcc 8.2.1 (GCC) 20181017
configuration: --enable-gpl --enable-version3 --enable-sdl2 --enable-fontconfig --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libtheora --enable-libtwolame --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libzimg --enable-lzma --enable-zlib --enable-gmp --enable-libvidstab --enable-libvorbis --enable-libvo-amrwbenc --enable-libmysofa --enable-libspeex --enable-libxvid --enable-libaom --enable-libmfx --enable-amf --enable-ffnvcodec --enable-cuvid --enable-d3d11va --enable-nvenc --enable-nvdec --enable-dxva2 --enable-avisynth
libavutil      56. 22.100 / 56. 22.100
libavcodec     58. 35.100 / 58. 35.100
libavformat    58. 20.100 / 58. 20.100
libavdevice    58.  5.100 / 58.  5.100
libavfilter     7. 40.101 /  7. 40.101
libswscale      5.  3.100 /  5.  3.100
libswresample   3.  3.100 /  3.  3.100
libpostproc    55.  3.100 / 55.  3.100

For help run: ffmpeg -h
For formats run: ffmpeg -formats | more
For codecs run: ffmpeg -codecs | more

Current directory is now: "D:\Vid_Sync\ffmpeg-4.1-win64-static\bin"
The bin directory has been added to PATH

D:\Vid_Sync\ffmpeg-4.1-win64-static\bin
>ffmpeg -f dshow -video_size 1280x720 -framerate 30 -vcodec h264 -i video="Logitech Webcam C930e" -copyinkf -c copy C:\Temp\C930e_test_20181208.mp4
ffmpeg version 4.1 Copyright (c) 2000-2018 the FFmpeg developers
  built with gcc 8.2.1 (GCC) 20181017
  configuration: --enable-gpl --enable-version3 --enable-sdl2 --enable-fontconfig --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libtheora --enable-libtwolame --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libzimg --enable-lzma --enable-zlib --enable-gmp --enable-libvidstab --enable-libvorbis --enable-libvo-amrwbenc --enable-libmysofa --enable-libspeex --enable-libxvid --enable-libaom --enable-libmfx --enable-amf --enable-ffnvcodec --enable-cuvid --enable-d3d11va --enable-nvenc --enable-nvdec --enable-dxva2 --enable-avisynth
  libavutil      56. 22.100 / 56. 22.100
  libavcodec     58. 35.100 / 58. 35.100
  libavformat    58. 20.100 / 58. 20.100
  libavdevice    58.  5.100 / 58.  5.100
  libavfilter     7. 40.101 /  7. 40.101
  libswscale      5.  3.100 /  5.  3.100
  libswresample   3.  3.100 /  3.  3.100
  libpostproc    55.  3.100 / 55.  3.100
[dshow @ 0000027c15a1b580] Could not set video options
video=Logitech Webcam C930e: I/O error

D:\Vid_Sync\ffmpeg-4.1-win64-static\bin
>ffmpeg -rtbufsize 100MB -f dshow -video_pin_name 1 -i video="Logitech Webcam C930e" -copyinkf -c copy C:\Temp\C930e_test_20181208.mp4
ffmpeg version 4.1 Copyright (c) 2000-2018 the FFmpeg developers
  built with gcc 8.2.1 (GCC) 20181017
  configuration: --enable-gpl --enable-version3 --enable-sdl2 --enable-fontconfig --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libtheora --enable-libtwolame --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libzimg --enable-lzma --enable-zlib --enable-gmp --enable-libvidstab --enable-libvorbis --enable-libvo-amrwbenc --enable-libmysofa --enable-libspeex --enable-libxvid --enable-libaom --enable-libmfx --enable-amf --enable-ffnvcodec --enable-cuvid --enable-d3d11va --enable-nvenc --enable-nvdec --enable-dxva2 --enable-avisynth
  libavutil      56. 22.100 / 56. 22.100
  libavcodec     58. 35.100 / 58. 35.100
  libavformat    58. 20.100 / 58. 20.100
  libavdevice    58.  5.100 / 58.  5.100
  libavfilter     7. 40.101 /  7. 40.101
  libswscale      5.  3.100 /  5.  3.100
  libswresample   3.  3.100 /  3.  3.100
  libpostproc    55.  3.100 / 55.  3.100
[dshow @ 0000022212cfaa40] Could not get media type.
video=Logitech Webcam C930e: I/O error

D:\Vid_Sync\ffmpeg-4.1-win64-static\bin
>ffmpeg -f dshow -video_size 1280x720 -framerate 30 -vcodec h264 -i video="Logitech Webcam C930e" -copyinkf -c copy C:\Temp\C930e_test_20181208.mp4 -loglevel debug
ffmpeg version 4.1 Copyright (c) 2000-2018 the FFmpeg developers
  built with gcc 8.2.1 (GCC) 20181017
  configuration: --enable-gpl --enable-version3 --enable-sdl2 --enable-fontconfig --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libtheora --enable-libtwolame --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libzimg --enable-lzma --enable-zlib --enable-gmp --enable-libvidstab --enable-libvorbis --enable-libvo-amrwbenc --enable-libmysofa --enable-libspeex --enable-libxvid --enable-libaom --enable-libmfx --enable-amf --enable-ffnvcodec --enable-cuvid --enable-d3d11va --enable-nvenc --enable-nvdec --enable-dxva2 --enable-avisynth
  libavutil      56. 22.100 / 56. 22.100
  libavcodec     58. 35.100 / 58. 35.100
  libavformat    58. 20.100 / 58. 20.100
  libavdevice    58.  5.100 / 58.  5.100
  libavfilter     7. 40.101 /  7. 40.101
  libswscale      5.  3.100 /  5.  3.100
  libswresample   3.  3.100 /  3.  3.100
  libpostproc    55.  3.100 / 55.  3.100
Splitting the commandline.
Reading option '-f' ... matched as option 'f' (force format) with argument 'dshow'.
Reading option '-video_size' ... matched as AVOption 'video_size' with argument '1280x720'.
Reading option '-framerate' ... matched as AVOption 'framerate' with argument '30'.
Reading option '-vcodec' ... matched as option 'vcodec' (force video codec ('copy' to copy stream)) with argument 'h264'.
Reading option '-i' ... matched as input url with argument 'video=Logitech Webcam C930e'.
Reading option '-copyinkf' ... matched as option 'copyinkf' (copy initial non-keyframes) with argument '1'.
Reading option '-c' ... matched as option 'c' (codec name) with argument 'copy'.
Reading option 'C:\Temp\C930e_test_20181208.mp4' ... matched as output url.
Reading option '-loglevel' ... matched as option 'loglevel' (set logging level) with argument 'debug'.
Finished splitting the commandline.
Parsing a group of options: global .
Applying option loglevel (set logging level) with argument debug.
Successfully parsed a group of options.
Parsing a group of options: input url video=Logitech Webcam C930e.
Applying option f (force format) with argument dshow.
Applying option vcodec (force video codec ('copy' to copy stream)) with argument h264.
Successfully parsed a group of options.
Opening an input file: video=Logitech Webcam C930e.
[dshow @ 0000020fc1ceb5c0] Could not set video options
video=Logitech Webcam C930e: I/O error

D:\Vid_Sync\ffmpeg-4.1-win64-static\bin
>ffmpeg -rtbufsize 100MB -f dshow -video_pin_name 1 -i video="Logitech Webcam C930e" -copyinkf -c copy C:\Temp\C930e_test_20181208.mp4 -loglevel debug
ffmpeg version 4.1 Copyright (c) 2000-2018 the FFmpeg developers
  built with gcc 8.2.1 (GCC) 20181017
  configuration: --enable-gpl --enable-version3 --enable-sdl2 --enable-fontconfig --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libtheora --enable-libtwolame --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libzimg --enable-lzma --enable-zlib --enable-gmp --enable-libvidstab --enable-libvorbis --enable-libvo-amrwbenc --enable-libmysofa --enable-libspeex --enable-libxvid --enable-libaom --enable-libmfx --enable-amf --enable-ffnvcodec --enable-cuvid --enable-d3d11va --enable-nvenc --enable-nvdec --enable-dxva2 --enable-avisynth
  libavutil      56. 22.100 / 56. 22.100
  libavcodec     58. 35.100 / 58. 35.100
  libavformat    58. 20.100 / 58. 20.100
  libavdevice    58.  5.100 / 58.  5.100
  libavfilter     7. 40.101 /  7. 40.101
  libswscale      5.  3.100 /  5.  3.100
  libswresample   3.  3.100 /  3.  3.100
  libpostproc    55.  3.100 / 55.  3.100
Splitting the commandline.
Reading option '-rtbufsize' ... matched as AVOption 'rtbufsize' with argument '100MB'.
Reading option '-f' ... matched as option 'f' (force format) with argument 'dshow'.
Reading option '-video_pin_name' ... matched as AVOption 'video_pin_name' with argument '1'.
Reading option '-i' ... matched as input url with argument 'video=Logitech Webcam C930e'.
Reading option '-copyinkf' ... matched as option 'copyinkf' (copy initial non-keyframes) with argument '1'.
Reading option '-c' ... matched as option 'c' (codec name) with argument 'copy'.
Reading option 'C:\Temp\C930e_test_20181208.mp4' ... matched as output url.
Reading option '-loglevel' ... matched as option 'loglevel' (set logging level) with argument 'debug'.
Finished splitting the commandline.
Parsing a group of options: global .
Applying option loglevel (set logging level) with argument debug.
Successfully parsed a group of options.
Parsing a group of options: input url video=Logitech Webcam C930e.
Applying option f (force format) with argument dshow.
Successfully parsed a group of options.
Opening an input file: video=Logitech Webcam C930e.
[dshow @ 000001431b62adc0] skipping pin "Capture" ("0") != requested "1"
[dshow @ 000001431b62adc0] Selecting pin Capture on video
[dshow @ 000001431b62adc0] Could not get media type.
video=Logitech Webcam C930e: I/O error

D:\Vid_Sync\ffmpeg-4.1-win64-static\bin
>

Edit - I'm using the GDCL Mpeg-4 Multiplexor from https://github.com/roman380/gdcl.co.uk-mpeg4. I thought this was just a standard mp4 multiplexor but it looks like it might have some modifications. Looking into this further now.

Someonerctm
Posts: 2
Joined: Fri Dec 07, 2018 6:08 am

Re: DirectShow Capture support for C930e webcam

Post by Someonerctm » Thu Dec 13, 2018 6:04 pm

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.

pandy
Posts: 184
Joined: Mon Feb 24, 2014 1:46 pm

Re: DirectShow Capture support for C930e webcam

Post by pandy » Mon Mar 25, 2019 11:45 am

Query your HW capabilities viewtopic.php?p=15075#p15075

NTFive
Posts: 1
Joined: Sun May 19, 2019 6:06 am

Re: DirectShow Capture support for C930e webcam

Post by NTFive » Sun May 19, 2019 6:35 am

Hi there,

I just bought a C930e and I'm very disappointed because I can't extract any H.264 from it.

Currently I am running a heavily modified custom version of Windows XP for very specific reasons.
I totally rely on this OS and upgrading to one of the newer Microsoft OSes or switching to Linux is not an option.

I have managed to make the webcam work with the Logitech drivers (by hacking the .inf files)
Logitech's webcam software now believes my C930e is a good old C920.
Everything works just fine, but streaming in 720p consumes way too much bandwidth without H.264. :(

I hope someone can come up with a method to use ffmpeg to extract some H.264 from this cam.

Are there any recent developments in this area I am not aware of ?

Post Reply
'