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. Zoom [1], Google Meets [2]).
Goal here is to provide a virtual webcam via v4l2loopback with a common set of filters that can be used everywhere.
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
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/community/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
gstreamer-1.0 (e.g. https://archlinux.org/packages/extra/x86_64/gstreamer/)
gst-python (e.g. https://archlinux.org/packages/extra/x86_64/gst-python/)
gst-plugins-base (e.g. https://archlinux.org/packages/extra/x86_64/gst-plugins-base/)
gst-plugins-good (e.g. https://archlinux.org/packages/extra/x86_64/gst-plugins-good/)
Optional:
gstreamer-vaapi for hardware acceleration (e.g. https://archlinux.org/packages/extra/x86_64/gstreamer-vaapi/)
Installation
Nix
The provided Nix package bundles all the necessary GStreamer dependencies and should “just work” on any distro.
Setup the cache. This step is optional, but it should speed up the installation process:
$ nix-env -iA cachix -f https://cachix.org/api/v1/install $ cachix use sohi
Install a specific release version/tag:
$ nix-env \
--install \
--file https://github.com/jashandeep-sohi/webcam-filters/archive/refs/tags/v0.3.0.tar.gz
Install a specific branch (e.g. master):
$ nix-env \
--install \
--file https://github.com/jashandeep-sohi/webcam-filters/archive/refs/heads/master.tar.gz
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"
Metadata
Release files for webcam-filters 0.3.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| webcam-filters-0.3.0.tar.gz | 24.3 kB | Without provenance | Details for webcam-filters-0.3.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| webcam_filters-0.3.0-py3-none-any.whl | Python 3 | none | any | Details for webcam_filters-0.3.0-py3-none-any.whl |
Total release size: 50.3 kB
Release files / webcam-filters-0.3.0.tar.gz
| Download URL | webcam-filters-0.3.0.tar.gz |
|---|---|
| Size | 24.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
bc6ce45ad3f6e88631d84b4e7046bba239e8e4aa532ebccdb6e858c715ac402a
|
|
BLAKE2b-256 checksum How to use checksums |
75fd83ad5e837e32b07b77d87f1bad32f8cddd4b294949e5b980d49066249802
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.1.10 CPython/3.9.7 Linux/5.8.0-1041-azure
|
Release files / webcam_filters-0.3.0-py3-none-any.whl
| Download URL | webcam_filters-0.3.0-py3-none-any.whl |
|---|---|
| Size | 26.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
2da9c695ce2a09b42d11c34e8dc89f31d4d4ba4d24ec25615a1c408674b4d5fe
|
|
BLAKE2b-256 checksum How to use checksums |
772b172e339c28393d9212ba71dade33d19da177cea20201d154159741a86a63
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.1.10 CPython/3.9.7 Linux/5.8.0-1041-azure
|
Security for webcam-filters 0.3.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.