Re: Logitech C920 - Cameras speed (fps) unstable when using two webcams

Joan,

That would be perfect! We are waiting for your progress. Please let us know when it is ready. We will do our tests and send you report.

If you handle this issue, is there chance to add option for multiple camera capture (example 3 or 4 cams)?

Re: Logitech C920 - Cameras speed (fps) unstable when using two webcams

So I got my C920 earlier this week and I've started experimenting with it. Let's make this the official Logitech C920 thread, and everyone should post their findings or issues with this camera. I'll keep in mind the holy grail of the thread, being able to record and preview two C920 at their full 1920×1080 @ 30 fps, simultaneously.

1. Exposure time.
The camera has a setting for exposure duration which is great. Extremely important for sport video as we already discussed in the forum. Combined with the HD frame size and the 30 fps it makes it a very interesting tool indeed.

To change the exposure time you have to go into the device property pages and to Camera control. I think the Logitech software also has a page where you can change it.

The mapping between the settings and actual durations is not published by Logitech though, and there are conflicting informations between the DirectShow spec and Logitech. They do have a lower level API where it's possible to set the duration by increments of 100µs, so I'll try to use that at some point in the future.

2. Framerate auto adjustment.
If you leave the exposure control on automatic, the exposure duration will adjust to the light conditions. As the exposure and framerate are partly interdependent, it may also alter the framerate. You don't want this.

Especially if you are indoors, the exposure will set itself to longer values, automatically decreasing the framerate.
To get the full 30 fps you need to set exposure on manual (and maybe get powerful artificial lights).

There seems to be a bug in the camera driver as it forgets the settings when you restart the streaming though.

3. Support in Kinovea
The list of available image sizes / framerates is somewhat limited in the current versions of Kinovea. I have started to change the code to get the full range of capabilities.

The camera has on-board compression and can stream to H.264 and MJPEG in addition to uncompressed.
At the moment Kinovea only exposes the configurations options corresponding to the H.264 stream due to some underlying limitation that I'm working on lifting.

USB 2.0 doesn't have the bandwidth for uncompressed full HD @ 30 fps, so getting the compressed stream is the only way to get the top score. However it means that the images have to be uncompressed on the computer to be displayed and then recompressed to save to disk. I'll later see if it's possible to directly save the MJPEG stream to disk.

Re: Logitech C920 - Cameras speed (fps) unstable when using two webcams

We use Logitech C920 with Windows 7, there is software Logitech Webcam Software that handle only one camera, it is tricky to handle two cameras, we do plug in - plug out manual operation with two cameras in order to do settings on both. I heard that there is application for Windows 8, Logitech Center where you can do settings of both cameras in the same time, never tried this.

Re: Logitech C920 - Cameras speed (fps) unstable when using two webcams

We are using two C920 with an simple laptop equipped with Windows 8. With 640x480 at 30fps we get reasonable results. Some non fluid images from time to time. Iterating is that the CPU buffer is 100% used when the both camera's are connected.
We can connect two camera's at the same time but the second camera isn't detected automatically.
Our plan is to get a powerful PC's with a 4gB videocard and see what we can do with that

Re: Logitech C920 - Cameras speed (fps) unstable when using two webcams

Some more experimentations on my side…

Drivers
On Windows 7 there are two capable drivers giving slightly different options.
The Microsoft driver that installs itself by default, and the Logitech driver that must be installed manually.

The MS driver provides the stream in YUY2 (an uncompressed format), MJPG and H264.
The Logitech driver provides RGB24, I420 (two uncompressed formats), MJPG and H264. (These options will be available for selection in the next version). I haven't yet found what the actual native uncompressed format of the camera is.

However there is a catch, the official Logitech driver provides the H.264 stream in an unusual way (on a secondary pin of the DirectShow filter), which makes it invisible to Kinovea and to the majority of DirectShow based capture applications.

On the upside, when using the Logitech driver, it is possible to get and set the exposure duration with 100µs granularity, with a lowest value at 300µs.

Both drivers lie to some degree with the list of framerates they support. For example when using MJPG output, the drivers report that they support 7 framerates, from 5 to 30 fps, but whatever we choose, it will always use 30 fps.

DirectShow internals
When we connect to the camera, there is some black magic done by DirectShow to find a suitable decoder for the camera output down to the application. DirectShow will search the installed codecs on the computer and look for the best ones to complete the connection.

This means that when the camera is outputting H264 for example, there is a specific codec that is selected to provide the decoding. It may be a third party codec installed as part of another application or one provided with Windows. The performance of this codec has a direct impact on performance and image quality.

The problem is that codecs register themselves with a "merit" value that changes their likelihood of being selected.
More tests are needed to see if it would be practical to try to bypass this system completely or find a set of known-to-work-well codecs for various camera output formats, or at least detect which codec ends up being used.

Re: Logitech C920 - Cameras speed (fps) unstable when using two webcams

It's great to read this thread. It shows how much work it takes to optimize and use all features for just one camera. Looks like I'll upgrade my C270 to a C920 smile

Re: Logitech C920 - Cameras speed (fps) unstable when using two webcams

Some more updates

USB topology
If you plan on using several webcams or if you have a lot of other USB devices connected to your computer, it is important to understand a bit about the USB topology to get the best of your system.

I want to write a longer piece about this because it will be best with schematics. In a nutshell, you want to connect each webcam to a separate root hub so that it gets its full bandwidth and power.

USB works with host controllers (piece of hardware), root hubs (one per host controller), regular hubs and devices. A root hub will source several USB ports on the computer. All of these ports will share the bus bandwidth. Cameras need a lot of bandwidth so it's best if you connect them to ports that belong to different root hubs.

Do not bother connecting the camera to a regular hub. The camera will share the bandwidth with other devices on the same root hub in addition to the devices connected downstream to the hub. A bus powered hub will also usually not be able to source enough current to a camera connected downstream.

To better understand a comptuer USB topology, I like to use USB tree viewer, it will show you the whole USB tree from controllers to devices. It also shows low level USB descriptors which can help understand what capabilities are supported by a camera at the USB level, especially for UVC compliant cameras like the C920.

USB 3.0 ports won't provide increased bandwidth to USB 2.0 devices. There is an entire USB 2.0 compatibility lane inside the USB 3.0 pipe.

Re: Logitech C920 - Cameras speed (fps) unstable when using two webcams

All regards to Joan efforts, it takes more than it can be described in few posts, we are just making tests with dual capture and writing test reports, this is not ''one man show''. More progress to come in next weeks.

Re: Logitech C920 - Cameras speed (fps) unstable when using two webcams

Upcoming in Kinovea
The configuration dialog now shows the various available stream formats (RGB24, MJPG, H264, etc.). On the C920, this allows the use of the streams that are compressed on-board by the camera, decreasing the bandwidth requirements.

For some specific stream formats (currently RGB24 and MJPG), the DirectShow's Intelligent Connect is not used and the plumbing is done manually. This has proven to be more reliable.

The vendor-specific exposure property from Logitech is now supported, allowing the configuration by 100µs increments instead of the default DirectShow property which is imprecise and badly supported by Logitech cameras. On the C920 the minimum value is 300µs.

A new capture pipeline has been implemented and integrated to streamline capture and recording.

For the MJPEG stream of the C920 and other cameras, the frames received are only decompressed for the preview. When recording they are directly pushed to the final file. The recording is given higher priority than the preview where a frame drop is not catastrophic. This greatly increases the throughput. I am able to record the full 1920x1080 @ 30 fps on my machine. We are still doing tests with Milan for the dual record scenario.

MJPEG is probably going to become the application perferred codec for output. It is simpler to implement and debug, mature JPEG libraries can be used, and its intraframe-only compression scheme makes it more suitable for frame-by-frame playback.

Re: Logitech C920 - Cameras speed (fps) unstable when using two webcams

The primary target of the C920 being video call, web casting and the like, the "infinity" focus is quite short (a few meters). When used in the field, we'll usually want to focus farther to get the clearest images possible. 
Check out the "Hubble-fix" from wxforums.net, the result is quite striking!

Re: Logitech C920 - Cameras speed (fps) unstable when using two webcams

This is true, but see also purpose of cameras in experiment with lenses, they are used for long range, rather infinite view recording, sky or landscape. Weather forecast cameras, panoramic cameras, surveillance...

We have done tons of records with logitechs where recording subject was not more than 10m from camera and everything looks great.

We will try some experiments with different lenses and let people how it works.

Re: Logitech C920 - Cameras speed (fps) unstable when using two webcams

Re-lenses, I think the C920 have a proprietary lens mount and the lens can't be swapped easily. (Haven't disassembled mine yet).

One thing that crossed my radar is this S-Mount for the C920 board.

Ah, if only all USB cameras used standard S-mount so we could swap in M12 lenses that would be great…
There are high quality wide-angle M12 lenses that would be very interesting to use, and we could reuse them when upgrading camera.

This guy went the other way and created a CS-mount adapter.

28 (edited by zamar24 2015-Jun-19 14:15:40)

Re: Logitech C920 - Cameras speed (fps) unstable when using two webcams

joan wrote:

USB 2.0 doesn't have the bandwidth for uncompressed full HD @ 30 fps, so getting the compressed stream is the only way to get the top score. However it means that the images have to be uncompressed on the computer to be displayed and then recompressed to save to disk. I'll later see if it's possible to directly save the MJPEG stream to disk.

Its possible to directly record 720P MJPG & PCM native footage from any webcam to AVI, and 1080P H264 & AAC natively compressed C920 stream to MP4 - in both cases without on-the-fly transcoding, with video & audio muxed by webcam capture software, just as the latest LWS (Logitech webcam software) does with very low CPU usage. Current FFMpeg Zeranoe Windows builds also allow that via commandline, see examples here: Webcam Stream Capture with Preview. While MJPG may be better suited for analyzing sport events due to frame-by-frame compression, H264 is a better fit due to smaller file size for conventional video recording and broadcasting as Milan mentioned below. smile

milandjupovac wrote:

Right now stop-action single-frame is not important for us. We are more focused to get routine and skills in practical work with multiple cameras, and than we are have second focus and that is localization of Kinovea in our country followed with education classes and than it comes popularization of open source software and sharing of knowledge. We are more interested to teach coaches, athletes, professors and others how to analyze human movement and that there are cheap tools on the market to do that. In this moment we do not have budget to purchase other expensive cameras, and we like option of dual capturing and fork with two cameras in the same time as well file naming when there is ton of videos you have to do at competition or training.