Skip to content

Commit

Permalink
Fix reactivating webcams and allow users to view existing virtual web…
Browse files Browse the repository at this point in the history
…cams
  • Loading branch information
intermezzio committed Jan 6, 2023
1 parent 23bb1ec commit 7fbe3f5
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 4 deletions.
9 changes: 7 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,11 @@ weffe -a
```
_NOTE_: If you ran this command after starting an application like Zoom, you will have to restart Zoom to see the new webcam.

To see what virtual cameras are already initialized, use the `-L` (list) flag:
```sh
weffe -L
```

## Usage

Running `weffe` without arguments streams to a webcam with no effects. Insert one or more command line arguments to add effects to the video. These effects can all be used together unless otherwise specified.
Expand Down Expand Up @@ -89,9 +94,9 @@ weffe -v your_video.mp4
weffe -sv dont_reverse_this_video.mp4
```

### Monitor Output
### Monitor Output (beta)

This option, released in v1.1, checks if the virtual webcam is being fed into an application (e.g. video calling software) and runs the webcam on demand. This feature is good if there are a lot of effects on the webcam as it can save computer resources while video calling platforms are off. In the off time, it streams a blank color to the webcam. However, it is still being tested and does not work when applications regularly probe the webcam to check if it's streaming (e.g. Discord opens and closes the webcam approx. every 3 seconds). This option requires the optional `inotify-tools` dependency.
This option checks if the virtual webcam is being fed into an application (e.g. video calling software) and runs the webcam on demand. This feature is good if there are a lot of effects on the webcam as it can save computer resources while video calling platforms are off. In the off time, it streams a blank color to the webcam. However, it is still being tested and does not work when applications regularly probe the webcam to check if it's streaming (e.g. Discord opens and closes the webcam approx. every 3 seconds). This option requires the optional `inotify-tools` dependency.

```sh
weffe -M
Expand Down
17 changes: 15 additions & 2 deletions weffe
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ activate=false
rootdir="$(dirname "$0")"
monitor=false

set -e
set +e

while getopts ":hv:rsi:o:w:t:b:f:z:B:SpaM" opt; do
while getopts ":hv:rsi:o:w:t:b:f:z:B:SpaMl" opt; do
case $opt in
a) activate=true
;;
Expand Down Expand Up @@ -62,6 +62,10 @@ while getopts ":hv:rsi:o:w:t:b:f:z:B:SpaM" opt; do
;;
M) monitor=true
;;
l) printf "v4l2-ctl --list-devices\n\n"
v4l2-ctl --list-devices
exit 0
;;
\?) echo "Invalid option -$OPTARG" >&2
exit 0
;;
Expand All @@ -72,7 +76,16 @@ if $activate
then
echo "Initializing virtual camera at /dev/video${output}"
echo "This may require sudo access"
modstatus=$( lsmod | grep v4l2loopback 2>&1 )
if [ -z "$modstatus" ]
then
echo "No existing virtual camera found"
else
echo "Removing existing virtual camera"
sudo modprobe -r v4l2loopback
fi
sudo modprobe v4l2loopback exclusive_caps=1 video_nr=$output card_label="Weffe"
echo "Initialized"
exit 0
fi

Expand Down

0 comments on commit 7fbe3f5

Please sign in to comment.