From fb4b45fbad14e5fd363b23971ee9ca900bda40b3 Mon Sep 17 00:00:00 2001 From: Klesh Wong Date: Wed, 13 Jul 2022 23:15:00 +0800 Subject: [PATCH] feat: virtual camera --- bin/virtcam | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/bin/virtcam b/bin/virtcam index 84af088..43c76de 100755 --- a/bin/virtcam +++ b/bin/virtcam @@ -14,16 +14,19 @@ sudo modprobe v4l2loopback -r -f # create 2 virtual webcam sudo modprobe v4l2loopback video_nr=21,22 card_label=virtcam1,virtcam2 exclusive_caps=1 + # pipe actual webcam to virtcams actualwebcam() { - if [ -n "$FAKER_PID" ]; then - kill -s INT "$FAKER_PID" - FAKER_PID= - fi ffmpeg -f v4l2 -i /dev/video0 -codec copy -f v4l2 /dev/video21 -f v4l2 /dev/video22 >/dev/null 2>&1 /dev/null 2>&1 /dev/null 2>&1 echo reversed clip created - ffmpeg -y -i ~/Video/seq.mp4 -i ~/Video/reversed.mp4 -filter_complex "[0:v] [1:v] concat=n=2:v=1 [v]" -map "[v]" loop.mp4 >/dev/null 2>&1 + ffmpeg -y -i ~/Video/seq.mp4 -i ~/Video/reversed.mp4 -filter_complex "[0:v] [1:v] concat=n=2:v=1 [v]" -map "[v]" ~/Video/loop.mp4 >/dev/null 2>&1 echo looping clip created kill -s INT $PID echo webcam stopped, enter looping mode, press [q] to resume webcam