Giter VIP home page Giter VIP logo

webcam-filters's Introduction

PyPI Update Nix Cache

webcam-filters

Add filters (background blur, etc) to your webcam on Linux.

Video conferencing applications tend to either lack video effects altogether or support only a limited set of capabilities on Linux (e.g. Zoom1, Google Meets2).

Goal here is to provide a virtual webcam via v4l2loopback with a common set of filters that can be used everywhere.

local

Usage

Passthrough (no-op):

$ webcam-filters --input-dev /dev/video0 --output-dev /dev/video3

Blur background:

$ webcam-filters --input-dev /dev/video0 --output-dev /dev/video3 --background-blur 150

Hardware acceleration (via VAAPI):

$ webcam-filters --input-dev /dev/video0 --output-dev /dev/video3 --background-blur 150 --hw-accel-api vaapi

Using docker:

$ docker run -it \
  --device=/dev/video0:/input-dev \
  --device=/dev/video3:/output-dev \
  ghcr.io/jashandeep-sohi/webcam-filters:master --background-blur 50

Dependencies

Other than the Python dependencies that can be automatically installed by Pip, there are a few system dependencies that require manual attention.

v4l2loopback

v4l2loopback kernel module is required to emulate a virtual webcam. See your distro's docs or v4l2loopback on how to install and set it up (e.g. https://archlinux.org/packages/extra/any/v4l2loopback-dkms/).

You'll probably want to create at least one loopback device (that's persistent on boot):

$ sudo tee /etc/modprobe.d/v4l2loopback.conf << "EOF"
# /dev/video3
options v4l2loopback video_nr=3
options v4l2loopback card_label="Virtual Webcam"
options v4l2loopback exclusive_caps=1
EOF
$ sudo modprobe v4l2loopback
$ v4l2-ctl --device /dev/video3 --info

Gstreamer

Installation

Nix

The provided Nix package bundles all the necessary GStreamer dependencies and should "just work" on any distro.

Install a specific release version/tag:

$ nix --experimental-features 'nix-command flakes' \
    profile
    install
    github:jashandeep-sohi/webcam-filters/vx.x.x

Install a specific branch (e.g. master):

$ nix --experimental-features 'nix-command flakes' \
    profile
    install
    github:jashandeep-sohi/webcam-filters/master

Hardware Acceleration

For VAAPI support with Nix on non-NixOS systems use nixGL:

$ nix-env \
    --file https://github.com/guibou/nixGL/archive/main.tar.gz \
    --install \
    --attr auto.nixGLDefault \
    --arg enable32bits false
$ export LIBVA_DRIVER_NAME=iHD # Or whatever works with your GPU
$ nixGL webcam-filters --input-dev /dev/video0 --output-dev /dev/video3 --hw-accel-api vaapi

On NixOS follow https://nixos.wiki/wiki/Accelerated_Video_Playback

Pipx/Pip

You can also use pipx or pip. Pipx is recommend to keep Python dependencies isolated. Keep in mind this will not install gst-python or any of the other GStreamer dependencies, so you'll have to install that yourself.

Latest stable:

$ pipx install --system-site-packages webcam-filters
$ # Or
$ pip install --user webcam-filters

Latest pre-release:

$ pipx install --system-site-packages --pip-args='--pre' webcam-filters
$ # Or
$ pip install --user --pre webcam-filters

Git:

$ url="git+https://github.com/jashandeep-sohi/webcam-filters.git"
$ pipx install --system-site-packages "$url"
$ # Or
$ pip install --user "$url"

Docker

The docker container wraps a Nix installation for those who prefer to have it dockerized.

You can retag the image locally if you don't want to refer to the long name:

$ docker tag ghcr.io/jashandeep-sohi/webcam-filters:master webcam-filters

You may also build the image locally:

$ nix --experimental-features 'nix-command flakes' run .#container.copyToDockerDaemon

  1. Zoom desktop client supports background blur as of version 5.7.6. Zoom on web does not.

  2. Google Meets supports background blur only on Chrome.

webcam-filters's People

Contributors

askz avatar dependabot[bot] avatar felixonmars avatar hs-neax avatar hsanjuan avatar jashandeep-sohi avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

webcam-filters's Issues

Hardware acceleration does not work with the radeonsi driver

Hi 👋

When I try to use --hw-accel vaapi the GStreamer pipeline does not run. I don't know if I miss something or if some feature is missing (NYI?) in the driver...?

$ GST_DEBUG=2 webcam-filters --input-dev /dev/video0 --output-dev /dev/video3 --background-blur 150 --hw-accel-api vaapi
Selected input: media-type=image/jpeg, width=1280 height=720 framerate=30/1
0:00:00.452510507 78424      0x1ea2550 WARN              vaapiblend gstvaapiblend.c:184:gst_vaapi_blend_initialize:<vaapiblend0> VPP does not support global alpha blending

(python3:78424): GStreamer-CRITICAL **: 21:06:44.103: The created element should be floating, this is probably caused by faulty bindings

(python3:78424): GStreamer-CRITICAL **: 21:06:44.104: The created element should be floating, this is probably caused by faulty bindings

(python3:78424): GStreamer-CRITICAL **: 21:06:44.105: The created element should be floating, this is probably caused by faulty bindings
Pipeline: READY
Pipeline: PAUSED
0:00:00.533376004 78424      0x201ecc0 WARN          v4l2bufferpool gstv4l2bufferpool.c:814:gst_v4l2_buffer_pool_start:<v4l2src1:pool0:src> Uncertain or not enough buffers, enabling copy threshold
INFO: Created TensorFlow Lite XNNPACK delegate for CPU.
0:00:01.189612022 78424      0x201ef00 WARN             vaapifilter gstvaapifilter.c:2409:gst_vaapi_filter_set_colorimetry_unlocked:<vaapifilter2> driver does not support '2:4:5:1' input colorimetry. vpp may fail or produce unexpected results.
0:00:01.189625357 78424      0x201ef00 WARN             vaapifilter gstvaapifilter.c:2419:gst_vaapi_filter_set_colorimetry_unlocked:<vaapifilter2> driver does not support 'sRGB' output colorimetry. vpp may fail or produce unexpected results.
0:00:01.209019915 78424      0x201ecc0 WARN                 v4l2src gstv4l2src.c:1001:gst_v4l2src_create:<v4l2src1> lost frames detected: count = 1 - ts: 0:00:00.671366999
0:00:01.212918189 78424 0x7f93140021e0 WARN           basetransform gstbasetransform.c:1370:gst_base_transform_setcaps:<vaapipostproc1> transform could not transform video/x-raw, width=(int)1280, height=(int)720, framerate=(fraction)30/1, interlace-mode=(string)progressive, pixel-aspect-ratio=(fraction)1/1, multiview-mode=(string)mono, multiview-flags=(GstVideoMultiviewFlagsSet)0:ffffffff:/right-view-first/left-flipped/left-flopped/right-flipped/right-flopped/half-aspect/mixed-mono, format=(string)RGBx in anything we support

The last line then repeats...
Any idea?
(Maybe the line ending with VPP does not support global alpha blending shows the problem)

Add a Nix package

Seems like a major problem right now is just installing this with the correct GStreamer dependencies across different distros.
Providing a Nix package is probably the only sane way to fix that. Maybe a container, but that would require messing around with mounting v4l2 devices into the container and running the container with correct caps.

"Invalid literal for Fraction"

On Ubuntu 21.04 (on which I had to install python3-gst-1.0):

$ webcam-filters --version
0.2.0
$ webcam-filters --input-dev /dev/video0 --output-dev /dev/video3 --background-blur 150
Traceback (most recent call last):
  File "/home/me/.local/bin/webcam-filters", line 8, in <module>
    sys.exit(cli())
  File "/home/me/.local/lib/python3.9/site-packages/click/core.py", line 1137, in __call__
    return self.main(*args, **kwargs)
  File "/home/me/.local/lib/python3.9/site-packages/click/core.py", line 1062, in main
    rv = self.invoke(ctx)
  File "/home/me/.local/lib/python3.9/site-packages/click/core.py", line 1404, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/me/.local/lib/python3.9/site-packages/click/core.py", line 763, in invoke
    return __callback(*args, **kwargs)
  File "/home/me/.local/lib/python3.9/site-packages/webcam_filters/main.py", line 137, in cli
    add_filters(
  File "/home/me/.local/lib/python3.9/site-packages/webcam_filters/gst.py", line 87, in add_filters
    structs = sorted(
  File "/home/me/.local/lib/python3.9/site-packages/webcam_filters/gst.py", line 90, in <lambda>
    Fraction(str(x.get_value("framerate"))),
  File "/usr/lib/python3.9/fractions.py", line 115, in __new__
    raise ValueError('Invalid literal for Fraction: %r' %
ValueError: Invalid literal for Fraction: '{15/2,5/1}'

ModuleNotFoundError: No module named 'gi'

See installation log below. Is there a python dependency or system dependency missing?

➜ asdf install python latest:3.9 
python-build 3.9.7 /home/mui2lol/.asdf/installs/python/3.9.7
Downloading Python-3.9.7.tar.xz...
-> https://www.python.org/ftp/python/3.9.7/Python-3.9.7.tar.xz
Installing Python-3.9.7...
Installed Python-3.9.7 to /home/mui2lol/.asdf/installs/python/3.9.7

~ took 1m 5s 
➜ asdf global python 3.9.7     
➜ python                             
Python 3.9.7 (default, Oct 28 2021, 10:16:54) 
[GCC 9.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> 
KeyboardInterrupt
>>> 

~ took 2s 
➜ pip install --user webcam-filters
Looking in indexes: https://anu9rng:****@rb-artifactory.bosch.com/artifactory/api/pypi/python-virtual/simple
Collecting webcam-filters
  Using cached https://rb-artifactory.bosch.com/artifactory/api/pypi/python-virtual/packages/packages/77/2b/172e339c28393d9212ba71dade33d19da177cea20201d154159741a86a63/webcam_filters-0.3.0-py3-none-any.whl (25 kB)
Requirement already satisfied: rich<11.0.0,>=10.7.0 in ./.local/lib/python3.9/site-packages (from webcam-filters) (10.12.0)
Requirement already satisfied: mediapipe<0.9.0,>=0.8.6 in ./.local/lib/python3.9/site-packages (from webcam-filters) (0.8.8.1)
Requirement already satisfied: click<9.0.0,>=8.0.1 in ./.local/lib/python3.9/site-packages (from webcam-filters) (8.0.3)
Requirement already satisfied: numpy<2.0.0,>=1.21.2 in ./.local/lib/python3.9/site-packages (from webcam-filters) (1.21.3)
Requirement already satisfied: click-completion<0.6.0,>=0.5.2 in ./.local/lib/python3.9/site-packages (from webcam-filters) (0.5.2)
Requirement already satisfied: opencv-contrib-python<5.0.0,>=4.5.3 in ./.local/lib/python3.9/site-packages (from webcam-filters) (4.5.4.58)
Collecting six
  Using cached https://rb-artifactory.bosch.com/artifactory/api/pypi/python-virtual/packages/packages/d9/5a/e7c31adbe875f2abbb91bd84cf2dc52d792b5a01506781dbcf25c91daf11/six-1.16.0-py2.py3-none-any.whl (11 kB)
Collecting jinja2
  Downloading https://rb-artifactory.bosch.com/artifactory/api/pypi/python-virtual/packages/packages/94/42/d8bca8e99789bcc35dfa9b03acaa8b518720d6e060163745bc2bf2ead842/Jinja2-3.0.2-py3-none-any.whl (133 kB)
     |████████████████████████████████| 133 kB 2.2 MB/s 
Requirement already satisfied: shellingham in ./.local/lib/python3.9/site-packages (from click-completion<0.6.0,>=0.5.2->webcam-filters) (1.4.0)
Requirement already satisfied: matplotlib in ./.local/lib/python3.9/site-packages (from mediapipe<0.9.0,>=0.8.6->webcam-filters) (3.4.3)
Requirement already satisfied: absl-py in ./.local/lib/python3.9/site-packages (from mediapipe<0.9.0,>=0.8.6->webcam-filters) (0.15.0)
Requirement already satisfied: wheel in ./.local/lib/python3.9/site-packages (from mediapipe<0.9.0,>=0.8.6->webcam-filters) (0.37.0)
Requirement already satisfied: protobuf>=3.11.4 in ./.local/lib/python3.9/site-packages (from mediapipe<0.9.0,>=0.8.6->webcam-filters) (3.19.0)
Collecting attrs>=19.1.0
  Using cached https://rb-artifactory.bosch.com/artifactory/api/pypi/python-virtual/packages/packages/20/a9/ba6f1cd1a1517ff022b35acd6a7e4246371dfab08b8e42b829b6d07913cc/attrs-21.2.0-py2.py3-none-any.whl (53 kB)
Requirement already satisfied: commonmark<0.10.0,>=0.9.0 in ./.local/lib/python3.9/site-packages (from rich<11.0.0,>=10.7.0->webcam-filters) (0.9.1)
Requirement already satisfied: pygments<3.0.0,>=2.6.0 in ./.local/lib/python3.9/site-packages (from rich<11.0.0,>=10.7.0->webcam-filters) (2.10.0)
Collecting colorama<0.5.0,>=0.4.0
  Using cached https://rb-artifactory.bosch.com/artifactory/api/pypi/python-virtual/packages/packages/44/98/5b86278fbbf250d239ae0ecb724f8572af1c91f4a11edf4d36a206189440/colorama-0.4.4-py2.py3-none-any.whl (16 kB)
Collecting MarkupSafe>=2.0
  Downloading https://rb-artifactory.bosch.com/artifactory/api/pypi/python-virtual/packages/packages/c2/db/314df69668f582d5173922bded7b58126044bb77cfce6347c5d992074d2e/MarkupSafe-2.0.1-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl (30 kB)
Collecting pyparsing>=2.2.1
  Using cached https://rb-artifactory.bosch.com/artifactory/api/pypi/python-virtual/packages/packages/1b/19/8d24092f75e3bc7b4b2a78c9c63664bdeb00298acd15fad5d614da2a25b1/pyparsing-3.0.3-py3-none-any.whl (96 kB)
Requirement already satisfied: pillow>=6.2.0 in ./.local/lib/python3.9/site-packages (from matplotlib->mediapipe<0.9.0,>=0.8.6->webcam-filters) (8.4.0)
Requirement already satisfied: kiwisolver>=1.0.1 in ./.local/lib/python3.9/site-packages (from matplotlib->mediapipe<0.9.0,>=0.8.6->webcam-filters) (1.3.2)
Requirement already satisfied: python-dateutil>=2.7 in ./.local/lib/python3.9/site-packages (from matplotlib->mediapipe<0.9.0,>=0.8.6->webcam-filters) (2.8.2)
Requirement already satisfied: cycler>=0.10 in ./.local/lib/python3.9/site-packages (from matplotlib->mediapipe<0.9.0,>=0.8.6->webcam-filters) (0.10.0)
Installing collected packages: six, pyparsing, MarkupSafe, jinja2, colorama, attrs, webcam-filters
Successfully installed MarkupSafe-2.0.1 attrs-21.2.0 colorama-0.4.4 jinja2-3.0.2 pyparsing-3.0.3 six-1.16.0 webcam-filters-0.3.0
WARNING: You are using pip version 21.2.3; however, version 21.3.1 is available.
You should consider upgrading via the '/home/mui2lol/.asdf/installs/python/3.9.7/bin/python3.9 -m pip install --upgrade pip' command.

~ took 4s 
➜ which webcam-filters    
/home/mui2lol/.local/bin/webcam-filters
➜ cat /home/mui2lol/.local/bin/webcam-filters                    
#!/home/mui2lol/.asdf/installs/python/3.9.7/bin/python3.9
# -*- coding: utf-8 -*-
import re
import sys
from webcam_filters.__main__ import main
if __name__ == '__main__':
    sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
    sys.exit(main())
➜ webcam-filters --version
Traceback (most recent call last):
  File "/home/mui2lol/.local/bin/webcam-filters", line 5, in <module>
    from webcam_filters.__main__ import main
  File "/home/mui2lol/.local/lib/python3.9/site-packages/webcam_filters/__main__.py", line 1, in <module>
    from .main import cli
  File "/home/mui2lol/.local/lib/python3.9/site-packages/webcam_filters/main.py", line 14, in <module>
    from .gst import (
  File "/home/mui2lol/.local/lib/python3.9/site-packages/webcam_filters/gst.py", line 6, in <module>
    import gi
ModuleNotFoundError: No module named 'gi'`

Caps is not iterable

I'm on master

❯ webcam-filters --input-dev /dev/video0 --output-dev /dev/vid
eo3 --background-blur 150
Traceback (most recent call last):
  File "/home/raffaele/.local/bin/webcam-filters", line 8, in <module>
    sys.exit(main())
  File "/home/raffaele/.local/lib/python3.10/site-packages/webcam_filters/__main__.py", line 5, in main
    cli.main(prog_name="webcam-filters")
  File "/home/raffaele/.local/lib/python3.10/site-packages/click/core.py", line 1055, in main
    rv = self.invoke(ctx)
  File "/home/raffaele/.local/lib/python3.10/site-packages/click/core.py", line 1404, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/raffaele/.local/lib/python3.10/site-packages/click/core.py", line 760, in invoke
    return __callback(*args, **kwargs)
  File "/home/raffaele/.local/lib/python3.10/site-packages/webcam_filters/main.py", line 156, in cli
    p.run()
  File "/home/raffaele/.local/lib/python3.10/site-packages/webcam_filters/gst.py", line 114, in run
    pipeline = self.build_pipeline()
  File "/home/raffaele/.local/lib/python3.10/site-packages/webcam_filters/gst.py", line 186, in build_pipeline
    input_caps = self.select_input()
  File "/home/raffaele/.local/lib/python3.10/site-packages/webcam_filters/gst.py", line 150, in select_input
    for s in caps:
TypeError: 'Caps' object is not iterable

Error while running the demo commands

$ webcam-filters --input-dev /dev/video0 --output-dev /dev/video3 --background-blur 150

Traceback (most recent call last):
  File "/home/eeroh/.local/bin/webcam-filters", line 8, in <module>
    sys.exit(cli())
  File "/home/eeroh/.local/lib/python3.9/site-packages/click/core.py", line 1137, in __call__
    return self.main(*args, **kwargs)
  File "/home/eeroh/.local/lib/python3.9/site-packages/click/core.py", line 1062, in main
    rv = self.invoke(ctx)
  File "/home/eeroh/.local/lib/python3.9/site-packages/click/core.py", line 1404, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/eeroh/.local/lib/python3.9/site-packages/click/core.py", line 763, in invoke
    return __callback(*args, **kwargs)
  File "/home/eeroh/.local/lib/python3.9/site-packages/webcam_filters/main.py", line 137, in cli
    add_filters(
  File "/home/eeroh/.local/lib/python3.9/site-packages/webcam_filters/gst.py", line 68, in add_filters
    for c in caps:
TypeError: 'Caps' object is not iterable

Zoom now natively supports Virtual Background images without a green screen on Linux

Just a PSA issue. This is supported since the August 20, 2021 release version 5.7.6 (31792.0820).

Changelog says:

Support for Virtual Background images without a green screen - Linux
The ability to use the Image as Virtual Background feature without the need of a green screen is now supported on Linux. System requirements will be provided in the Virtual Background System Requirements Support article.

The requirements seem modest:

    Zoom desktop client, version 5.7.6 or higher
    Supported processors 
        Intel i3 
            4 cores or higher
            8th generation or higher
        Intel i5
            4 cores or higher
            6th generation or higher
        Intel i7
            4 cores or higher
            4th generation or higher
        Intel i9 
            4 cores or higher
            4th generation or higher
        Intel Xeon
            4-cores or higher
            2.0Ghz or higher
        AMD
            8 logical cores or higher
            3.0Ghz or higher

It does include a "Blur" filter along with the regular virtual background stuff.

Error when trying to start

Hello.
When I try to start webcam-filters, I get this error:

# webcam-filters --input-dev /dev/video0 --output-dev /dev/video3
Selected input: media-type=image/jpeg, width=1280 height=720 framerate=30/1
Error from /GstPipeline:pipeline0/GstV4l2Sink:v4l2sink0: Cannot identify device '/dev/video3'.

I haven't got video3 device, so error isn't that device is busy. Starting this with different outputs has no effect:

# webcam-filters --input-dev /dev/video0 --output-dev /dev/video10
Selected input: media-type=image/jpeg, width=1280 height=720 framerate=30/1
Error from /GstPipeline:pipeline0/GstV4l2Sink:v4l2sink0: Cannot identify device '/dev/video10'.

I sure that my camera is video0.
I installed webcam-filters via pipx, but using nix doesn't fix this error.
I have satisfied all dependencies.
I use Ach Linux with

# uname -a
Linux arch 5.10.70-1-lts #1 SMP Thu, 30 Sep 2021 09:43:10 +0000 x86_64 GNU/Linux

How can I fix this error?
Thanks for your help.

P. S. Sorry for my english, I'm from another county.

Unable to use it with NixOS and Intel Graphics HD

I'm struggling to use it with NixOS unstable:

$ webcam-filters --input-dev /dev/video0 --output-dev /dev/video3 --hw-accel-api vaapi --background-blur 50
failed to find and enable element 'vaapijpegdec'
failed to find and enable element 'vaapimpeg2dec'
failed to find and enable element 'vaapih264dec'
failed to find and enable element 'vaapih265dec'
failed to find and enable element 'vaapivc1dec'
failed to find and enable element 'vaapivp8dec'
failed to find and enable element 'vaapivp9dec'
unable to find a suitable input format
Aborted!
$ webcam-filters --input-dev /dev/video0 --output-dev /dev/video3 --background-blur 50
unable to find a suitable input format
Aborted!
$ export LIBVA_DRIVER_NAME=iHD
$ webcam-filters --input-dev /dev/video0 --output-dev /dev/video3 --hw-accel-api vaapi --background-blur 50
failed to find and enable element 'vaapijpegdec'
failed to find and enable element 'vaapimpeg2dec'
failed to find and enable element 'vaapih264dec'
failed to find and enable element 'vaapih265dec'
failed to find and enable element 'vaapivc1dec'
failed to find and enable element 'vaapivp8dec'
failed to find and enable element 'vaapivp9dec'
unable to find a suitable input format
Aborted!
$ export LIBVA_DRIVER_NAME=i965
$ webcam-filters --input-dev /dev/video0 --output-dev /dev/video3 --hw-accel-api vaapi --background-blur 50
failed to find and enable element 'vaapijpegdec'
failed to find and enable element 'vaapimpeg2dec'
failed to find and enable element 'vaapih264dec'
failed to find and enable element 'vaapih265dec'
failed to find and enable element 'vaapivc1dec'
failed to find and enable element 'vaapivp8dec'
failed to find and enable element 'vaapivp9dec'
unable to find a suitable input format
Aborted!

Even if I have v4l2loopback and my hardware acceleration configured:

$ lsmod| grep loopback
v4l2loopback
videodev

I also tried with docker:

$ docker run -it --device=/dev/video0:/input-dev --device=/dev/video3:/output-dev ghcr.io/jashandeep-sohi/webcam-filters:master --background-blur 50
docker: Error response from daemon: error gathering device information while adding custom device "/dev/video3": no such file or directory.
ERRO[0000] error waiting for container: context canceled

NB: it would be grep to document how to install it at system level.

Allow setting output pixel format

Currently, it's hard-coded to YUY2. Allow setting multiple values from CLI and let gstreamer pick the best compatible one for the pipeline.

Can't install because of Python version

pip install:

ERROR: Ignored the following versions that require a different python version: 0.1.0 Requires-Python >=3.9,<3.10; 0.1.0a0 Requires-Python >=3.9,<3.10; 0.2.0 Requires-Python >=3.9,<3.10; 0.2.0a0 Requires-Python >=3.9,<3.10; 0.2.0a1 Requires-Python >=3.9,<3.10; 0.2.0a2 Requires-Python >=3.9,<3.10; 0.2.1 Requires-Python >=3.9,<3.10; 0.2.1a0 Requires-Python >=3.9,<3.10; 0.2.2 Requires-Python >=3.8,<3.10; 0.2.2a0 Requires-Python >=3.8,<3.10;0.3.0 Requires-Python >=3.8,<3.10
ERROR: Could not find a version that satisfies the requirement webcam-filters (from versions: none)
ERROR: No matching distribution found for webcam-filters

git:
ERROR: Package 'webcam-filters' requires a different Python: 3.11.3 not in '<3.11,>=3.8'

Cannot install on Ubuntu 22.04.2 LTS

Using pip:

$ pip install --user webcam-filters
ERROR: Could not find a version that satisfies the requirement webcam-filters (from versions: none)
ERROR: No matching distribution found for webcam-filters
$ pip -V
pip 22.0.2 from /usr/lib/python3/dist-packages/pip (python 3.10)

Using pipx:

$ pipx install --system-site-packages webcam-filters
Fatal error from pip prevented installation. Full pip output in file:
    /home/szhumatiy/.local/pipx/logs/cmd_2023-02-21_11.04.10_pip_errors.log

Some possibly relevant errors from pip install:
    ERROR: Could not find a version that satisfies the requirement webcam-filters (from versions: none)
    ERROR: No matching distribution found for webcam-filters

Error installing webcam-filters.

Via url:

$ url="git+https://github.com/jashandeep-sohi/webcam-filters.git"
$ pipx install --system-site-packages "$url"
Traceback (most recent call last):
  File "/usr/bin/pipx", line 8, in <module>
    sys.exit(cli())
  File "/usr/lib/python3/dist-packages/pipx/main.py", line 779, in cli
    return run_pipx_command(parsed_pipx_args)
  File "/usr/lib/python3/dist-packages/pipx/main.py", line 202, in run_pipx_command
    return commands.install(
  File "/usr/lib/python3/dist-packages/pipx/commands/install.py", line 30, in install
    package_name = package_name_from_spec(
  File "/usr/lib/python3/dist-packages/pipx/commands/common.py", line 333, in package_name_from_spec
    package_name = venv.install_package_no_deps(
  File "/usr/lib/python3/dist-packages/pipx/venv.py", line 268, in install_package_no_deps
    old_package_set = self.list_installed_packages()
  File "/usr/lib/python3/dist-packages/pipx/venv.py", line 348, in list_installed_packages
    pip_list = json.loads(cmd_run.stdout.strip())
  File "/usr/lib/python3.10/json/__init__.py", line 346, in loads
    return _default_decoder.decode(s)
  File "/usr/lib/python3.10/json/decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/usr/lib/python3.10/json/decoder.py", line 355, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

Python plugins not loading on OpenSUSE

[23:21:59] ~ $ GST_DEBUG=GST_PLUGIN_LOADING:4,pyplugin:6 webcam-filters --background-blur 50 --input-dev /dev/video5 --output-dev /dev/video0
0:00:00.000268384 18134 0x5626dde96a70 INFO      GST_PLUGIN_LOADING gstplugin.c:325:_priv_gst_plugin_initialize: registering 0 static plugins
0:00:00.000325815 18134 0x5626dde96a70 INFO      GST_PLUGIN_LOADING gstplugin.c:233:gst_plugin_register_static: registered static plugin "staticelements"
0:00:00.000332994 18134 0x5626dde96a70 INFO      GST_PLUGIN_LOADING gstplugin.c:235:gst_plugin_register_static: added static plugin "staticelements", result: 1
0:00:00.197454235 18134 0x5626dde96a70 INFO      GST_PLUGIN_LOADING gstplugin.c:915:_priv_gst_plugin_load_file_for_registry: plugin "/usr/lib64/gstreamer-1.0/libgstvideo4linux2.so" loaded
Selectd input: media-type=image/jpeg, width=1280 height=720 framerate=30/1
0:00:00.210186485 18134 0x5626dde96a70 INFO      GST_PLUGIN_LOADING gstplugin.c:915:_priv_gst_plugin_load_file_for_registry: plugin "/usr/lib64/gstreamer-1.0/libgstcoreelements.so" loaded
0:00:00.215944899 18134 0x5626dde96a70 INFO      GST_PLUGIN_LOADING gstplugin.c:915:_priv_gst_plugin_load_file_for_registry: plugin "/usr/lib64/gstreamer-1.0/libgstplayback.so" loaded
0:00:00.218019679 18134 0x5626dde96a70 INFO      GST_PLUGIN_LOADING gstplugin.c:915:_priv_gst_plugin_load_file_for_registry: plugin "/usr/lib64/gstreamer-1.0/libgstvideoconvert.so" loaded
Traceback (most recent call last):
  File "/home/hector/.local/bin/webcam-filters", line 8, in <module>
    sys.exit(cli())
  File "/home/hector/.local/pipx/venvs/webcam-filters/lib64/python3.9/site-packages/click/core.py", line 1137, in __call__
    return self.main(*args, **kwargs)
  File "/home/hector/.local/pipx/venvs/webcam-filters/lib64/python3.9/site-packages/click/core.py", line 1062, in main
    rv = self.invoke(ctx)
  File "/home/hector/.local/pipx/venvs/webcam-filters/lib64/python3.9/site-packages/click/core.py", line 1404, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/hector/.local/pipx/venvs/webcam-filters/lib64/python3.9/site-packages/click/core.py", line 763, in invoke
    return __callback(*args, **kwargs)
  File "/home/hector/.local/pipx/venvs/webcam-filters/lib64/python3.9/site-packages/webcam_filters/main.py", line 139, in cli
    add_filters(
  File "/home/hector/.local/pipx/venvs/webcam-filters/lib64/python3.9/site-packages/webcam_filters/gst.py", line 159, in add_filters
    selfie.set_property("model", selfie_segmentation_model)
AttributeError: 'NoneType' object has no attribute 'set_property'

@hsanjuan creating a new issue for this.

I don't see libgstpython.so being loaded, which means none of Python plugins also get loaded. Normally, it looks something like this:

0:00:01.029100122 12710 0x55eb5f0b6c70 LOG                 pyplugin gstpythonplugin.c:232:plugin_init: Checking to see if libpython is already loaded                                                                                    
0:00:01.029108435 12710 0x55eb5f0b6c70 LOG                 pyplugin gstpythonplugin.c:235:plugin_init: libpython is already loaded                
0:00:01.029111008 12710 0x55eb5f0b6c70 LOG                 pyplugin gstpythonplugin.c:254:plugin_init: python was already initialized
0:00:01.029116664 12710 0x55eb5f0b6c70 LOG                 pyplugin gstpythonplugin.c:274:plugin_init: Running with python version '3.9.6 (default, Jun 30 2021, 10:22:16) 
[GCC 11.1.0]'                                                                                                                                                                                                                                 
0:00:01.029118772 12710 0x55eb5f0b6c70 LOG                 pyplugin gstpythonplugin.c:276:plugin_init: initializing pygobject                           
0:00:01.029188105 12710 0x55eb5f0b6c70 DEBUG               pyplugin gstpythonplugin.c:156:gst_python_plugin_load: GST_PLUGIN_PATH set to /home/gamma/.local/pipx/venvs/webcam-filters/lib/python3.9/site-packages/webcam_filters/plugins:
0:00:01.029203475 12710 0x55eb5f0b6c70 DEBUG               pyplugin gstpythonplugin.c:48:gst_python_plugin_load_file: loading plugin cv2_boxfilter                                                               
0:00:01.164450264 12710 0x55eb5f0b6c70 INFO                pyplugin gstpythonplugin.c:103:gst_python_plugin_load_file: Valid plugin             
0:00:01.164474670 12710 0x55eb5f0b6c70 DEBUG               pyplugin gstpythonplugin.c:48:gst_python_plugin_load_file: loading plugin numpy_where                                                                                              0:00:01.166064073 12710 0x55eb5f0b6c70 INFO                pyplugin gstpythonplugin.c:103:gst_python_plugin_load_file: Valid plugin
0:00:01.166078845 12710 0x55eb5f0b6c70 DEBUG               pyplugin gstpythonplugin.c:48:gst_python_plugin_load_file: loading plugin selfie_segmentation                                                                           
0:00:01.356304339 12710 0x55eb5f0b6c70 INFO                pyplugin gstpythonplugin.c:103:gst_python_plugin_load_file: Valid plugin                                                
0:00:01.356338024 12710 0x55eb5f0b6c70 DEBUG               pyplugin gstpythonplugin.c:121:gst_python_load_directory: Couldn't open Python plugin dir: Error opening directory “python”: No such file or directory
0:00:01.356344484 12710 0x55eb5f0b6c70 DEBUG               pyplugin gstpythonplugin.c:176:gst_python_plugin_load: GST_PLUGIN_SYSTEM_PATH not set
0:00:01.356352301 12710 0x55eb5f0b6c70 DEBUG               pyplugin gstpythonplugin.c:121:gst_python_load_directory: Couldn't open Python plugin dir: Error opening directory “/home/gamma/.gstreamer-1.0/plugins/python”: No such file or dir
ectory                                                                                                                                                                                                                                        
0:00:01.356358134 12710 0x55eb5f0b6c70 DEBUG               pyplugin gstpythonplugin.c:121:gst_python_load_directory: Couldn't open Python plugin dir: Error opening directory “lib/gstreamer-1.0/python”: No such file or directory
0:00:01.356364671 12710 0x55eb5f0b6c70 INFO      GST_PLUGIN_LOADING gstplugin.c:915:_priv_gst_plugin_load_file_for_registry: plugin "/usr/lib/gstreamer-1.0/libgstpython.so" loaded

The only thing I can think of is libgstpython.so isn't in a path that GStreamer looks for plugins by default. What happens if you add /usr/lib64/gstreamer-1.0/ to GST_PLUGIN_PATH?

GST_PLUGIN_PATH="/usr/lib64/gstreamer-1.0:$GST_PLUGIN_PATH" GST_DEBUG=GST_PLUGIN_LOADING:4,pyplugin:6 webcam-filters --background-blur 50 ...

Originally posted by @hsanjuan in #4 (comment)

Add option to enable VAAPI hardware acceleration

Currently, if the input source is image/jpeg, decodebin will just use the software decoder jpegdec. GStreamer VAAPI plugin has a vaapijpegdec, that could take it's place possibly giving better performance.

Look into optionally enabling VAAPI support.

[DOC] Install on Ubuntu 21.04

Setup

sudo apt install v4l2loopback-dkms v4l-utils python3-pip python3-gst-1.0 gstreamer1.0-plugins-good gstreamer1.0-python3-plugin-loader

sudo tee /etc/modprobe.d/v4l2loopback.conf << "EOF"
# /dev/video3
options v4l2loopback video_nr=3
options v4l2loopback card_label="Virtual Webcam"
options v4l2loopback exclusive_caps=1
EOF

sudo modprobe v4l2loopback

pip install --user webcam-filters

Validate

webcam-filters --version
v4l2-ctl --device /dev/video0 --info # Input
v4l2-ctl --device /dev/video3 --info # Output

Use

webcam-filters --input-dev /dev/video0 --output-dev /dev/video3 --background-blur 100

Caps object is not iterable

When running webcam-filters I get the following traceback

➜  ~ webcam-filters --verbose --input-dev /dev/video0 --output-dev /dev/video3 --background-blur 150

Traceback (most recent call last):
  File "/home/restore/.local/bin/webcam-filters", line 9, in <module>
    sys.exit(main())
  File "/home/restore/.local/lib/python3.8/site-packages/webcam_filters/__main__.py", line 5, in main
    cli.main(prog_name="webcam-filters")
  File "/home/restore/.local/lib/python3.8/site-packages/click/core.py", line 1062, in main
    rv = self.invoke(ctx)
  File "/home/restore/.local/lib/python3.8/site-packages/click/core.py", line 1404, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/restore/.local/lib/python3.8/site-packages/click/core.py", line 763, in invoke
    return __callback(*args, **kwargs)
  File "/home/restore/.local/lib/python3.8/site-packages/webcam_filters/main.py", line 154, in cli
    add_filters(
  File "/home/restore/.local/lib/python3.8/site-packages/webcam_filters/gst.py", line 98, in add_filters
    for s in caps:
TypeError: 'Caps' object is not iterable

I tried different devices but always the same result. Anything else I can check?

GStreamer plugin selfie_seg does not exist

I'm trying to get the background blurring to work on my machine.
It fails with a similar error as #12

 File "/home/hector/.local/pipx/venvs/webcam-filters/lib64/python3.9/site-packages/webcam_filters/gst.py", line 159, in add_filters
    selfie.set_property("model", selfie_segmentation_model)
AttributeError: 'NoneType' object has no attribute 'set_property'

Running gst-insped-1.0 selfie_seg returns

No such element or plugin 'selfie_seg'

Googling for gstreamer plugin selfie_seg literally yields no results.

Where exactly does that plugin come from and how can I install that on my machine?

"AttributeError: 'NoneType' object has no attribute 'set_property'" when setting blur

Running Debian bullseye here, with python 3.9 and gstreamer 1.18.4 (though python3-gst 1.18.3). When I try to start things up (after creating a v4l2loopback device per the README, at /dev/video11):

$ webcam-filters --input-dev /dev/video2 --output-dev /dev/video11 --background-blur 150
Traceback (most recent call last):
  File "/home/brian/.local/bin/webcam-filters", line 8, in <module>
    sys.exit(cli())
  File "/home/brian/.local/pipx/venvs/webcam-filters/lib/python3.9/site-packages/click/core.py", line 1137, in __call__
    return self.main(*args, **kwargs)
  File "/home/brian/.local/pipx/venvs/webcam-filters/lib/python3.9/site-packages/click/core.py", line 1062, in main
    rv = self.invoke(ctx)
  File "/home/brian/.local/pipx/venvs/webcam-filters/lib/python3.9/site-packages/click/core.py", line 1404, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/brian/.local/pipx/venvs/webcam-filters/lib/python3.9/site-packages/click/core.py", line 763, in invoke
    return __callback(*args, **kwargs)
  File "/home/brian/.local/pipx/venvs/webcam-filters/lib/python3.9/site-packages/webcam_filters/main.py", line 137, in cli
    add_filters(
  File "/home/brian/.local/pipx/venvs/webcam-filters/lib/python3.9/site-packages/webcam_filters/gst.py", line 152, in add_filters
    selfie.set_property("model", selfie_segmentation_model)
AttributeError: 'NoneType' object has no attribute 'set_property'

numpy_where element does not negoitate cap correctly

As stated in #3, I have a problem where the command, when launched with some parameters for resolution / framerate, exits after one second without showing any error message. Example:

$ webcam-filters --input-dev /dev/video0 --output-dev /dev/video3 --background-blur 150
Selectd input: media-type=image/jpeg, width=1280 height=720 framerate=30/1

(python3:125359): GStreamer-CRITICAL **: 20:04:27.677: The created element should be floating, this is probably caused by faulty bindings

(python3:125359): GStreamer-CRITICAL **: 20:04:27.677: The created element should be floating, this is probably caused by faulty bindings

(python3:125359): GStreamer-CRITICAL **: 20:04:27.678: The created element should be floating, this is probably caused by faulty bindings
INFO: Created TensorFlow Lite XNNPACK delegate for CPU.
$ 

Actually, at least with my webcam (a Logitech HD Pro C920), the only working parameters are when setting the resolution / framerate to 1920x1080 at 30 FPS (image/jpeg).

Just tried at the moment to run it with the env variable GST_DEBUG=1 and I get this error just before it gives back the prompt:

0:00:01.066575233 125506      0x215ac00 ERROR                 python numpy_where.py:148:do_aggregate: buffer is too small for requested array

AttributeError: __enter__ when running with blur

Hi, I'm still struggling to get blur to work on Ubuntu 20.04. I struggled with #4 but got past that by installing gstreamer1.0-python3-plugin-loader. The command does not 'crash' now but it spits out an infinite stream of errors:

% GST_DEBUG=GST_PLUGIN_LOADING:4,pyplugin:6 webcam-filters --input-dev /dev/video0 --output-dev /dev/video3 --background-blur 150 | sed 's/jgrgt/jgrgt/g'
0:00:00.000339346 88314      0x1229670 INFO      GST_PLUGIN_LOADING gstplugin.c:318:_priv_gst_plugin_initialize: registering 0 static plugins
0:00:00.000423577 88314      0x1229670 INFO      GST_PLUGIN_LOADING gstplugin.c:226:gst_plugin_register_static: registered static plugin "staticelements"
0:00:00.000450943 88314      0x1229670 INFO      GST_PLUGIN_LOADING gstplugin.c:228:gst_plugin_register_static: added static plugin "staticelements", result: 1
0:00:00.008871418 88314      0x1229670 INFO      GST_PLUGIN_LOADING gstplugin.c:1524:gst_plugin_ext_dep_extract_env_vars_paths:<plugin36> ignoring environment variable content '': either not an absolute path or not a path at all
0:00:00.008884089 88314      0x1229670 INFO      GST_PLUGIN_LOADING gstplugin.c:1524:gst_plugin_ext_dep_extract_env_vars_paths:<plugin36> ignoring environment variable content '1': either not an absolute path or not a path at all
0:00:00.009128618 88314      0x1229670 INFO      GST_PLUGIN_LOADING gstplugin.c:1524:gst_plugin_ext_dep_extract_env_vars_paths:<plugin106> ignoring environment variable content '': either not an absolute path or not a path at all
0:00:00.013450325 88314      0x1229670 INFO      GST_PLUGIN_LOADING gstplugin.c:902:_priv_gst_plugin_load_file_for_registry: plugin "/usr/lib/x86_64-linux-gnu/gstreamer-1.0/libgstvideo4linux2.so" loaded
Selectd input: media-type=image/jpeg, width=1280 height=720 framerate=30/1
0:00:00.016463374 88314      0x1229670 INFO      GST_PLUGIN_LOADING gstplugin.c:902:_priv_gst_plugin_load_file_for_registry: plugin "/usr/lib/x86_64-linux-gnu/gstreamer-1.0/libgstcoreelements.so" loaded
0:00:00.017510553 88314      0x1229670 INFO      GST_PLUGIN_LOADING gstplugin.c:902:_priv_gst_plugin_load_file_for_registry: plugin "/usr/lib/x86_64-linux-gnu/gstreamer-1.0/libgstplayback.so" loaded
0:00:00.018003740 88314      0x1229670 INFO      GST_PLUGIN_LOADING gstplugin.c:902:_priv_gst_plugin_load_file_for_registry: plugin "/usr/lib/x86_64-linux-gnu/gstreamer-1.0/libgstvideoconvert.so" loaded
0:00:00.021918098 88314      0x1229670 LOG                 pyplugin gstpythonplugin.c:227:plugin_init: Checking to see if libpython is already loaded
0:00:00.021953189 88314      0x1229670 LOG                 pyplugin gstpythonplugin.c:230:plugin_init: libpython is already loaded
0:00:00.021958312 88314      0x1229670 LOG                 pyplugin gstpythonplugin.c:249:plugin_init: python was already initialized
0:00:00.021967731 88314      0x1229670 LOG                 pyplugin gstpythonplugin.c:253:plugin_init: Running with python version '3.8.10 (default, Jun  2 2021, 10:49:15) 
[GCC 9.4.0]'
0:00:00.021972050 88314      0x1229670 LOG                 pyplugin gstpythonplugin.c:255:plugin_init: initializing pygobject
0:00:00.022180382 88314      0x1229670 DEBUG               pyplugin gstpythonplugin.c:154:gst_python_plugin_load: GST_PLUGIN_PATH set to /home/jgrgt/.local/lib/python3.8/site-packages/webcam_filters/plugins:
0:00:00.022221452 88314      0x1229670 DEBUG               pyplugin gstpythonplugin.c:48:gst_python_plugin_load_file: loading plugin cv2_boxfilter
0:00:00.144117053 88314      0x1229670 INFO                pyplugin gstpythonplugin.c:103:gst_python_plugin_load_file: Valid plugin
0:00:00.144157775 88314      0x1229670 DEBUG               pyplugin gstpythonplugin.c:48:gst_python_plugin_load_file: loading plugin selfie_segmentation
0:00:00.395388933 88314      0x1229670 INFO                pyplugin gstpythonplugin.c:103:gst_python_plugin_load_file: Valid plugin
0:00:00.395410970 88314      0x1229670 DEBUG               pyplugin gstpythonplugin.c:48:gst_python_plugin_load_file: loading plugin numpy_where
0:00:00.396734247 88314      0x1229670 INFO                pyplugin gstpythonplugin.c:103:gst_python_plugin_load_file: Valid plugin
0:00:00.396762556 88314      0x1229670 DEBUG               pyplugin gstpythonplugin.c:121:gst_python_load_directory: Couldn't open Python plugin dir: Error opening directory “python”: No such file or directory
0:00:00.396772276 88314      0x1229670 DEBUG               pyplugin gstpythonplugin.c:172:gst_python_plugin_load: GST_PLUGIN_SYSTEM_PATH not set
0:00:00.396783639 88314      0x1229670 DEBUG               pyplugin gstpythonplugin.c:121:gst_python_load_directory: Couldn't open Python plugin dir: Error opening directory “/home/jgrgt/.gstreamer-1.0/plugins/python”: No such file or directory
0:00:00.396793250 88314      0x1229670 DEBUG               pyplugin gstpythonplugin.c:121:gst_python_load_directory: Couldn't open Python plugin dir: Error opening directory “lib/x86_64-linux-gnu/gstreamer-1.0/python”: No such file or directory
0:00:00.396802097 88314      0x1229670 INFO      GST_PLUGIN_LOADING gstplugin.c:902:_priv_gst_plugin_load_file_for_registry: plugin "/usr/lib/x86_64-linux-gnu/gstreamer-1.0/libgstpython.so" loaded
INFO: Created TensorFlow Lite XNNPACK delegate for CPU.
0:00:00.420456846 88314      0x1ecccc0 INFO      GST_PLUGIN_LOADING gstplugin.c:902:_priv_gst_plugin_load_file_for_registry: plugin "/usr/lib/x86_64-linux-gnu/gstreamer-1.0/libgstjpeg.so" loaded
Traceback (most recent call last):
  File "/home/jgrgt/.local/lib/python3.8/site-packages/webcam_filters/plugins/python/selfie_segmentation.py", line 151, in do_transform_ip
    with inbuf_info:
AttributeError: __enter__

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
Traceback (most recent call last):
  File "/home/jgrgt/.local/lib/python3.8/site-packages/webcam_filters/plugins/python/cv2_boxfilter.py", line 104, in do_transform_ip
  File "/home/jgrgt/.local/lib/python3.8/site-packages/webcam_filters/plugins/python/selfie_segmentation.py", line 169, in do_transform_ip
    with inbuf_info:
AttributeError: __enter__
    except Gst.MapError as e:

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/gi/overrides/__init__.py", line 32, in __getattr__
  File "/home/jgrgt/.local/lib/python3.8/site-packages/webcam_filters/plugins/python/cv2_boxfilter.py", line 115, in do_transform_ip
    return getattr(self._introspection_module, name)
  File "/usr/lib/python3/dist-packages/gi/module.py", line 131, in __getattr__
    except Gst.MapError as e:
  File "/usr/lib/python3/dist-packages/gi/overrides/__init__.py", line 32, in __getattr__
    raise AttributeError("%r object has no attribute %r" % (
AttributeError: 'gi.repository.Gst' object has no attribute 'MapError'
    return getattr(self._introspection_module, name)
  File "/usr/lib/python3/dist-packages/gi/module.py", line 131, in __getattr__
    raise AttributeError("%r object has no attribute %r" % (
AttributeError: 'gi.repository.Gst' object has no attribute 'MapError'
Traceback (most recent call last):
  File "/home/jgrgt/.local/lib/python3.8/site-packages/webcam_filters/plugins/python/cv2_boxfilter.py", line 104, in do_transform_ip
Traceback (most recent call last):
  File "/home/jgrgt/.local/lib/python3.8/site-packages/webcam_filters/plugins/python/selfie_segmentation.py", line 151, in do_transform_ip
    with inbuf_info:
AttributeError: __enter__

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
    with inbuf_info:
  File "/home/jgrgt/.local/lib/python3.8/site-packages/webcam_filters/plugins/python/cv2_boxfilter.py", line 115, in do_transform_ip
AttributeError: __enter__

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/jgrgt/.local/lib/python3.8/site-packages/webcam_filters/plugins/python/selfie_segmentation.py", line 169, in do_transform_ip
    except Gst.MapError as e:
  File "/usr/lib/python3/dist-packages/gi/overrides/__init__.py", line 32, in __getattr__
    except Gst.MapError as e:
  File "/usr/lib/python3/dist-packages/gi/overrides/__init__.py", line 32, in __getattr__
    return getattr(self._introspection_module, name)
    return getattr(self._introspection_module, name)
  File "/usr/lib/python3/dist-packages/gi/module.py", line 131, in __getattr__
  File "/usr/lib/python3/dist-packages/gi/module.py", line 131, in __getattr__
    raise AttributeError("%r object has no attribute %r" % (
    raise AttributeError("%r object has no attribute %r" % (
AttributeError: 'gi.repository.Gst' object has no attribute 'MapError'
AttributeError: 'gi.repository.Gst' object has no attribute 'MapError'
Traceback (most recent call last):
  File "/home/jgrgt/.local/lib/python3.8/site-packages/webcam_filters/plugins/python/numpy_where.py", line 109, in do_aggregate
    self.selected_samples(cbuf.pts, cbuf.dts, cbuf.duration, None)
AttributeError: 'Where' object has no attribute 'selected_samples'

Any ideas what I'm still missing?

Unable to install

  1. Created a virtualenv
  2. Installed pipx
  3. Got below error:
PIP STDOUT
----------

PIP STDERR
----------
ERROR: Could not find a version that satisfies the requirement webcam-filters (from versions: none)
ERROR: No matching distribution found for webcam-filters

$ python3 --version
Python 3.7.7

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.