xpra icon
Bug tracker and wiki

Opened 21 months ago

Last modified 3 weeks ago

#1231 assigned task

win32 and osx webcam capture

Reported by: Antoine Martin Owned by: Antoine Martin
Priority: major Milestone: 2.3
Component: encodings Version: trunk
Keywords: webcam Cc:

Description (last modified by Antoine Martin)

A native port should solve #1113 on OSX (also blocked by #840) and will allow us to improve platform support and remove the dependency on opencv.

Also remove the hard-coded csc dependency.

Attachments (3)

webcam.py (3.5 KB) - added by Antoine Martin 3 weeks ago.
working capture script
opencv.patch (3.6 KB) - added by Antoine Martin 3 weeks ago.
PKGBUILD patch to limit the number of opencv modules we build with makepkg
webcam_avfoundation.py (3.7 KB) - added by Antoine Martin 3 weeks ago.
port to AVFoundation

Download all attachments as: .zip

Change History (10)

comment:1 Changed 21 months ago by Antoine Martin

Description: modified (diff)
Status: newassigned

Hopefully we can use the same code for enumerating video devices on osx. (see ticket:1113#comment:4)

The same code can probably be used to capture the whole desktop on win32: DirectShow and may help with #389.

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

comment:7 Changed 3 months ago by Antoine Martin

Milestone: 1.02.3

Changed 3 weeks ago by Antoine Martin

Attachment: webcam.py added

working capture script

comment:8 Changed 3 weeks ago by Antoine Martin

The macos capture script above is based on How can I capture iSight frames with Python in Snow Leopard?. It works.. just not on my dev VM (light comes on, but frames never arrive), so I have to ssh to the mac mini to test it.

Still TODO:

Note: the py2app packaging for QTKit involved using packages and not modules? (IIRC)


For win32:

See also #1627

Last edited 3 weeks ago by Antoine Martin (previous) (diff)

comment:9 Changed 3 weeks ago by Antoine Martin

Description: modified (diff)
Summary: ffmpeg webcam capture codecwin32 and osx webcam capture

Changed 3 weeks ago by Antoine Martin

Attachment: opencv.patch added

PKGBUILD patch to limit the number of opencv modules we build with makepkg

comment:10 Changed 3 weeks ago by Antoine Martin

The patch above removes all the dependencies we don't need from the opencv MSYS2 package build, saving around 80MB of disk space.
The savings for our installer package are much smaller (~5MB) because we already trimmed it quite a bit and the file is compressed.

This should make things less brittle too: the opencv package seems to break very regularly in MSYS2 due to the huge amount of dependencies it has and because of the way the module loads them all - they would need to rebuild the package every time a dependency is updated.

Only problem is that the 32-bit version crashes hard, even the simple opencv_version.exe tool does... so r18290 disables webcam support in 32-bit builds.

Changed 3 weeks ago by Antoine Martin

Attachment: webcam_avfoundation.py added

port to AVFoundation

comment:11 Changed 3 weeks ago by Antoine Martin

We now build AVFoundation (r18246, also for python3: r18296 + r18297), and we have a nasty py2app packaging workaround too: r18298.

The webcam port to AVFoundation above might work, but we're blocked by this pyobjc bug: Support marshalling OS_dispatch_queue on macOS 10.10 and 10.11
I'm not sure if this can be worked around using ctypes either.

Once that's fixed, we'll need to to parse the sampleBuffer object using:
from Quartz import CoreVideo then:

Last edited 3 weeks ago by Antoine Martin (previous) (diff)
Note: See TracTickets for help on using tickets.