xpra icon
Bug tracker and wiki

#1113 closed enhancement (fixed)

improve webcam support

Reported by: Antoine Martin Owned by: alas
Priority: major Milestone: 1.0
Component: encodings Version: trunk
Keywords: Cc:

Description (last modified by Antoine Martin)

Follow up from #1030. See http://xpra.org/trac/wiki/Webcam.

  • there is no systray menu for it
  • framerate is low
  • black and white only, low resolution (hardcoded csc dependencies)
  • no support for multiple sessions per server..
  • detecting when devices are added or removed? (dbus?)
  • it uses too much bandwidth (mostly wasted too)
  • Fedora dkms packaging for v4l2loopback?
  • investigate win32 and osx support (shadow server / remote webcam)

Attachments (2)

new-webcam-menu.png (20.2 KB) - added by Antoine Martin 17 months ago.
new systray menu shows my webcam as option
osx-device-notifications.patch (14.3 KB) - added by Antoine Martin 16 months ago.
try to get notifications when USB devices are added or removed

Download all attachments as: .zip

Change History (10)

comment:1 Changed 21 months ago by Antoine Martin

Description: modified (diff)
Status: newassigned

We should also add support for native H264: Using the Logitech C920 webcam with Gstreamer

Last edited 18 months ago by Antoine Martin (previous) (diff)

comment:2 Changed 17 months ago by Antoine Martin

Updates:

  • finally found the fix for the offset hack: r12822 (will backport)
  • update webcam tray menu when devices are added or removed (linux only via python-inotify): r12819, packaging updates in r12821, fixup in r12820
  • r12823 should now support multiple users: load the kernel module with modprobe v4l2loopback devices=4 and the xpra server will try all devices until it finds one it can use (not fully tested)
  • r12825 makes sure we filter out video devices that cannot do capture

The webcam tool now shows a lot more device information.

Maybe too late for us, but I've just found a python ctypes interface for v4l2: https://pypi.python.org/pypi/v4l2

As for v4l2loopback, packaging it for dkms is too hard (dkms always seem to cause more problems that it solves for me too). Why isn't this merged upstream? Can we help push it? The code is stable and does not change much.

Remaining issues:


This is what the systray now looks like:
new systray menu shows my webcam as option

Last edited 17 months ago by Antoine Martin (previous) (diff)

comment:3 Changed 17 months ago by Antoine Martin

More links on win32 device events API:

OSX:

As for framerate, without going as far as refactoring the window-source code so we can use it for sending webcam frames, maybe we can send frames based on the line latency. (ie: 200ms round trip -> allow 4 frames in flight for a 20fps target)

Changed 17 months ago by Antoine Martin

Attachment: new-webcam-menu.png added

new systray menu shows my webcam as option

Changed 16 months ago by Antoine Martin

try to get notifications when USB devices are added or removed

comment:4 Changed 16 months ago by Antoine Martin

The patch above attempts to use IOKit.py to get device notifications for OSX, but it has a number of problems:

  • can't re-use the same main loop as GTK, so it uses its own thread and main loop - which may be the cause of other problems..
  • not very stable
  • had to modify IOKit.py
  • can't get the device path (that part crashes if you try to use it)
  • webcams don't work on OSX anyway since we cannot build opencv..

Similar / related code:

Webcam API links:

Last edited 16 months ago by Antoine Martin (previous) (diff)

comment:5 Changed 16 months ago by Antoine Martin

Owner: changed from Antoine Martin to alas
Status: assignednew

r12834 solves the framerate issue over slower links by calculating how many frames-in-flight we should have and try to keep to that number.
It adds XPRA_WEBCAM_FPS means we try to send that many frames per second (ie: the default value of 20 will send a frame every 50 milliseconds), unless the ack packets start coming in late.
Debug output:

may_send_webcam_frame() latency=307, not acked=6, target=6

Not dealing with shadow servers, because I don't see how this would work.

This will do for this release, will follow up in #1231.

comment:6 Changed 16 months ago by Antoine Martin

Milestone: 0.181.0

Milestone renamed

comment:7 Changed 13 months ago by Antoine Martin

  • r13832: improved webcam timers management, etc (see commit message)
  • see also #1268

comment:8 Changed 10 months ago by Antoine Martin

Resolution: fixed
Status: newclosed

Not heard back, closing.

Note: See TracTickets for help on using tickets.