DirectShow Capture support for C930e webcam

Announcements made by users.
zamar24
Posts: 9
Joined: Sun Apr 19, 2015 6:20 am

DirectShow Capture support for C930e webcam

Post by zamar24 » Fri Jul 10, 2015 6:12 pm

FFMpeg Dshow capture capabilities allow to capture footage from many "exotic" and modern webcams in unified manner, including popular C920 webcam's H264 stream. Current Logitech C930e model advanced capabilities like H264 and SVC streams aren't supported yet. Can we discuss supporting this webcam here?

C930 is UVC 1.5 compliant, and its capabilities and interfaces appear significantly different from UVC 1.1 compliant C920. Since dalbani has C930 webcam and programming skills, and expressed interest in joint work on this project, it can be enjoyable experience. :)

As mentioned in H.264 / SVC documentat​ion for C930e thread on Logitech forum, C930e H264 - MJPEG hack (Multiplexed Payload Format) seems primarily developed for compatibility with Win 7 that doesn't have integrated support for UVC 1.5 in contrast with Win 8.1. Latest Skype is capable of using both mentioned C930e H264 interfaces, but earlier attempts to use its prime UVC 1.5 interface were unstable so they stay with H264-MJPEG hack for now, unless the user PC provides GPU hardware decoding - encoding of source MJPEG stream to H264 on-the-fly. Skype devs say the later is preferable for stream stability, but it may be caused by Skype code deficiencies rather than the webcam's.

Windows 8.1 Camera App (modern UI) works well with C930e H264 native stream recording, and its assumed to use UVC 1.5 compliant stream rather than MJPEG hack. Users report however that capturing H264 @ 30 fps requires very good lighting, otherwise frame rate drops to 15 fps likely due to higher resulting bitrate at low light due to higher exposure and gain values required, which still needs to fit into C930e chipset and USB 2.0 bandwidth limitations.

As to using webcam's SVC capabilities, FFMpeg might be one of the very few programs if any able to do this... in the future, though it was primarily targeting Skype and similar Enterprise Video Conferencing packages like Skype for Business, so they just choose and broadcast the best resolution native H264 stream for a given network speed and specs without transcoding or broadcasting obsolete MJPEG. Also note, in contrast with C920, the C930e firmware is updatable, and Logitech periodically issues updates, which presume to cover any deficiencies in Windows generic UVC 1.5 driver.
Last edited by zamar24 on Fri Jul 10, 2015 6:50 pm, edited 1 time in total.

sambul92
Posts: 11
Joined: Tue Mar 31, 2015 4:39 am

Re: DirectShow Capture support for C930e webcam

Post by sambul92 » Fri Jul 10, 2015 7:06 pm

Would be nice to have this webcam fully supported by ffmpeg. I found corresponding standards can be downloaded here:

USB Video Class 1.5 and 1.1
USB_Video_Payload_H 264_1 0 (H264 / MJPEG Hack)

Also interesting interface test tool output results in Win 8 for the webcam were found:

- USBTree log
- DirectShow_Capture_Capabilities (DSCC) log
Attachments
C930e.zip
(25.08 KiB) Downloaded 439 times
Last edited by sambul92 on Sat Jul 11, 2015 11:42 pm, edited 3 times in total.

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

Re: DirectShow Capture support for C930e webcam

Post by rogerdpack » Fri Jul 10, 2015 11:13 pm

so you want H.264 and raw video simultaneously? Help me understand the utility here?

sambul92
Posts: 11
Joined: Tue Mar 31, 2015 4:39 am

Re: DirectShow Capture support for C930e webcam

Post by sambul92 » Sat Jul 11, 2015 12:26 am

For C930e Logitech doesn't offer drivers or software, completely relying on Windows UVC drivers and apps support such as latest Skype and MS Lync 2013 (thought its WHQL driver might be distributed via Windows Update?). As posted here, C930e video interfaces are tricky:

- for the webcam to be supported by Win 7 UVC 1.1 driver, Logitech added H264 / MJPEG hack to raw/MJPG interface, which allows to send H264 content muxed into MJPEG stream
- for the webcam to be supported by Win 8+ UVC 1.5 driver, Logitech added a separate H264 UVC 1.5 interface, were H264 stream is sent in clear
- the webcam can send alternative H264 streams through both above interfaces with lower resolution in parallel (not just one chosen stream as I understand), so a messenger can dynamically choose the SVC H264 stream that best fits now available network bandwidth.

It looks like DirectShow and its tools may have some issues deciphering full webcam capabilities, but that's what a snippet of the attached DSCC log shows for example:

Code: Select all

#### Capability: 70

 * `AM_MEDIA_TYPE`:
  * Data: `76 69 64 73 00 00 10 00 80 00 00 AA 00 38 9B 71 4D 4A 50 47 00 00 10 00 80 00 00 AA 00 38 9B 71 01 00 00 00 00 00 00 00 00 EC 5E 00 80 9F 58 05 56 C3 CE 11 BF 01 00 AA 00 55 59 5A 00 00 00 00 58 00 00 00 88 5C 7B 00`
  * Format Data: `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 40 FD 58 00 00 00 00 15 16 05 00 00 00 00 00 28 00 00 00 80 07 00 00 38 04 00 00 01 00 18 00 4D 4A 50 47 00 EC 5E 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00`
  * `.subtype`: `FourCC MJPG`
  * `.bFixedSizeSamples`: `1`
  * `.bTemporalCompression`: `0`
  * `.lSampleSize`: `6,220,800`
  * `.cbFormat`: `88`
  * `VIDEOINFOHEADER`:
  * `.rcSource`: (`0`, `0`) - (`0`, `0`)
  * `.rcTarget`: (`0`, `0`) - (`0`, `0`)
  * `.dwBitRate`: `1492992000`
  * `.dwBitErrorRate`: `0`
  * `.AvgTimePerFrame`: `33 3333`
  * `BITMAPINFOHEADER`:
   * `.biSize`: `40`
   * `.biWidth`: `1920`
   * `.biHeight`: `1080`
   * `.biPlanes`: `1`
   * `.biBitCount`: `24`
   * `.biCompression`: `1196444237` `MJPG`
   * `.biSizeImage`: `6,220,800`
 * `VIDEO_STREAM_CONFIG_CAPS`:
  * Data: `80 9F 58 05 56 C3 CE 11 BF 01 00 AA 00 55 59 5A 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`: `{05589F80-C356-11CE-BF01-00AA0055595A}`
  * `.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`

#### Capability: 71

 * `AM_MEDIA_TYPE`:
  * Data: `76 69 64 73 00 00 10 00 80 00 00 AA 00 38 9B 71 4D 4A 50 47 00 00 10 00 80 00 00 AA 00 38 9B 71 01 00 00 00 00 00 00 00 00 EC 5E 00 A0 76 2A F7 0A EB D0 11 AC E4 00 00 C0 CC 16 BA 00 00 00 00 70 00 00 00 60 80 7B 00`
  * Format Data: `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 40 FD 58 00 00 00 00 15 16 05 00 00 00 00 00 00 00 00 00 00 00 00 00 10 00 00 00 09 00 00 00 81 11 8D 00 00 00 00 00 28 00 00 00 80 07 00 00 38 04 00 00 01 00 18 00 4D 4A 50 47 00 EC 5E 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00`
  * `.subtype`: `FourCC MJPG`
  * `.bFixedSizeSamples`: `1`
  * `.bTemporalCompression`: `0`
  * `.lSampleSize`: `6,220,800`
  * `.cbFormat`: `112`
  * `VIDEOINFOHEADER2`:
 * Unknown Capabilities:
  * Type: `{F72A76A0-EB0A-11D0-ACE4-0000C0CC16BA}`
  * Data: `A0 76 2A F7 0A EB D0 11 AC E4 00 00 C0 CC 16 BA 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`
[/size]

Capability 70 looks like H264 stream muxed into MJPEG format, as ffmpeg shows too. I wonder how to teach ffmpeg dshow to recognize & copy to MP4 the stream as H264? Capability 71 is supposed to show a choice of alternative SVC H264 streams that can be captured instead of the main H264 stream.

It seems DSCC tool couldn't identify any H264 capabilities of the UVC 1.5 webcam interface, despite UVC 1.5 is supported by DirectShow, but may be the tool is not smart enough, or the interface was switched off by webcam firmware settings (hardly). Relevant info is given in How to support hardware encoded H264 though UVC thread, where Roman R. (DSCC author) also gave some hints.

Would be nice for ffmpeg to enumerate and capture at least one of H264 streams sent by C930e webcam, i.e. the one muxed as MJPEG, or the other sent as H264 in clear. :) It looks like dalbani has the webcam and wants to help with this if you need any info, also you can look through C930e latest firmware settings. Important is, guvcview already can capture both stream types from C930e in Linux, but not SVC, so its code may help to implement similar features in ffmpeg dshow. Its author got webcam interface docs saying Logitech is good at supporting webcams in open source projects, so might share them.

Here are ffmpeg dshow current issues with C930e support in Windows:

- can't identify as H264 and enumerate any H264 stream muxed by webcam hardware into MJPEG, and respectively can't COPY such stream to MP4 without transcoding in Win 7/8+
- can't enumerate any H264 stream sent in clear from UVC 1.5 webcam interface (should support in Win 8+ only)
- can't enumerate, separate and allow to capture any SVC H264 lower resolution stream, sent from any of the above 2 interfaces, i.e.muxed into MJPEG or sent in clear (should support in Win 8+ only)

sambul92
Posts: 11
Joined: Tue Mar 31, 2015 4:39 am

Re: DirectShow Capture support for C930e webcam

Post by sambul92 » Sun Jul 12, 2015 12:06 pm

The following was posted so far by various folks:

If the camera exposes H.264 capture caps "the standard way", you should be able to see it by enumerating its capabilities. One of the ways to see it is DirectShowCaptureCapabilities tool showing everything you have programmatically via IAMStreamConfig interface. Another way is to use GraphStudioNext with capture filter inserted and walking though pin media types. Either way you should see H264 or AVC1 subtypes or biCompression values.
You are interested in the pin that shows PIN_CATEGORY_CAPTURE via IKsPropertySet::Get method. – Roman R.


EnumerateVideoCaptureFilterCapabilities

-------------------

With UVC 1.5 driver installed (from Microsoft), use pin 1 (not 0) and you will get a ton of H264 formats.

-------------------
This is the closest I have gotten on this journey, but still isn't quite right:

Code: Select all

ffmpeg -report -f dshow -i video="Logitech Webcam C930e" -s 1920x1080 -r 30 -video_pin_name 1 -vcodec H264 -c copy -f mp4 Logitechc930eFeed.mp4
-------------------
Can use up to 1080p (30fps) on both mjpeg & yuyv no problems but can only get up to 720p with h264. If you push it higher you get the V4L2_CORE error.

How to properly use guvcview to take advantage of the SVC-related advanced features with the Logitech C930?

sambul92
Posts: 11
Joined: Tue Mar 31, 2015 4:39 am

Re: DirectShow Capture support for C930e webcam

Post by sambul92 » Sun Jul 12, 2015 12:38 pm

dalbani wrote:Hello,
Has anyone had any success with the Logitech C930?

There's a discussion on StackOverflow that matches with my own experience: it doesn't work (correctly).
Or at least we only get access to the raw and (hackish) H.264-in-MJPEG streams, but no standard H.264 stream.
And I'm not even talking of the SVC (simulcast) capabilities of the webcam.

Windows 8+ is supposed to support UVC 1.5 / SVC but I couldn't find out if / what had to be done to use it.
dalbani wrote: The way I see it, the C930e has almost been made for Skype (and Lync).
So, although I haven't tested myself and people have reported issues, it's supposed to work.

It is my understanding that the H.264-in-MJPEG hack is due to problems on the Windows platform.
But, apart from the "base" H.264 stream itself, I'm specifically interested in the SVC capabilities (i.e. getting multiple streams simultaneously off the webcam).
Going back to basics, I know ffmpeg can't now enumerate C930e H264 UVC 1.5 streams, but... are you able to capture it to a file without transcoding with low CPU load? Try this command:

Code: Select all

ffmpeg -s 1920x1080 -framerate 30 -rtbufsize 100MB -f dshow -vcodec h264 -acodec aac -i video="Logitech HD Pro Webcam C930e":audio="Microphone (HD Pro Webcam C930e)" -c copy K:\Video\C930e.mp4
You can check the output file codecs with MediaInfo. The question is, does C930e audio pin show AAC capabilities when checked in GraphStudioNext, or only PCM? Test capturing the graph created by Skype or Windows Camera App when running C930e, using GraphStudioNext and DirectShowSpy. Or simply insert the webcam capture filter and analyze its pins exposed in GraphStudioNext as suggested above by Roman. If successful, pls post the graph with pin dropdown options.

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

Re: DirectShow Capture support for C930e webcam

Post by rogerdpack » Tue Jul 14, 2015 4:14 pm

So basically it doesn't advertise "normal" h264 media type, only mjpg?

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

Re: DirectShow Capture support for C930e webcam

Post by dalbani » Thu Jul 16, 2015 1:58 pm

Hello,

I've gathered some information regarding the C930e on Windows.

First, using GraphStudioNext, I could indeed see a second "Capture" pin which exposes H.264 streams.
But the "stream format" tab seems to have an issue (see attachments to this message).

Then, using ffmpeg, I've listed the devices:

Code: Select all

[dshow @ 0000000002eeb700] DirectShow video devices (some may be both video and
audio devices)
[dshow @ 0000000002eeb700]  "Logitech Webcam C930e"
[dshow @ 0000000002eeb700]     Alternative name "@device_pnp_\\?\usb#vid_046d&pi
d_0843&mi_00#6&33100fc4&0&0000#{65e8773d-8f56-11d0-a3b9-00a0c9223196}\global"
[dshow @ 0000000002eeb700] DirectShow audio devices
[dshow @ 0000000002eeb700]  "Microphone (2- Logitech Webcam C930e)"
[dshow @ 0000000002eeb700]     Alternative name "@device_cm_{33D9A762-90C8-11D0-
BD43-00A0C911CE86}\wave_{EE8EEA49-DA37-4839-BD40-A1E1D05B1273}"
[dshow @ 0000000002eeb700]  "Microphone (3- High Definition Audio Device)"
[dshow @ 0000000002eeb700]     Alternative name "@device_cm_{33D9A762-90C8-11D0-
BD43-00A0C911CE86}\wave_{C0E7C9E0-C8CE-42B8-929B-AC5E6E99535A}"
Here's a few other commands that I've run and provide interesting information:

Code: Select all

> ffmpeg -f d show -video_pin_name "0" -i video="Logitech Webcam C930e"
Input #0, dshow, from 'video=Logitech Webcam C930e':
  Duration: N/A, start: 7879.228000, bitrate: N/A
    Stream #0:0: Video: rawvideo (YUY2 / 0x32595559), yuyv422, 640x480, 30 tbr, 10000k tbn, 30 tbc

Code: Select all

> ffmpeg -f d show -video_pin_name "1" -i video="Logitech Webcam C930e"
[dshow @ 000000000476b680] Could not get media type.
video=Logitech Webcam C930e: Input/output error
Attachments
Screenshot (4).png
Screenshot (3).png
Screenshot (1).png

sambul92
Posts: 11
Joined: Tue Mar 31, 2015 4:39 am

Re: DirectShow Capture support for C930e webcam

Post by sambul92 » Thu Jul 16, 2015 11:16 pm

Hi dalbani,

Useful results. Lets set aside SVC and MJPG for now, and look into H264 UVC 1.5 native stream only. 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.

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
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. Now this webcam is priced at consumer level, so its purchased by both businesses and consumers, and on Logitech and Skype forums mostly consumers post crying Qs about it. ;)

How to install DirectShowSpy:

To install Filter Graph Spy: • Download the binary DLL from version control repository (DirectShowSpy.dll – Win32, x64), get also helper .BAT files here.
• COM register the DLL on target system, for example from command line using regsvr32 utility “regsvr32 DirectShowSpy.dll” (administrative privilege elevation required on Vista)
• On Vista+ operating systems it is also required to make included SDK proppage.dll library available and registered in the system, see Vista related post for more details (http://alax.info/blog/944)

To uninstall:
• use “regsvr32 /u” utility to unregister the DLL, close all DirectShow based applications or reboot OS, and delete the file; see also a related thread on MSDN Forums (http://social.msdn.microsoft.com/Forums ... 34e5144769)

sambul92
Posts: 11
Joined: Tue Mar 31, 2015 4:39 am

Re: DirectShow Capture support for C930e webcam

Post by sambul92 » Fri Jul 17, 2015 2:29 pm

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.

Post Reply
'