Skip to content

Instantly share code, notes, and snippets.

@ntaraujo
Created December 6, 2020 19:54
Show Gist options
  • Save ntaraujo/eb6f00fd6bd47cf0c2d09c747d43e3b4 to your computer and use it in GitHub Desktop.
Save ntaraujo/eb6f00fd6bd47cf0c2d09c747d43e3b4 to your computer and use it in GitHub Desktop.
IP webcam connection
#!/bin/sh
# Exit if error
set -e
# My cam
WEBCAM="~/Projects/ipwebcam-gst/run-videochat.sh -w 1920 -h 1080"
# Unsure
case "$1" in
wifi)
;;
*)
# adb isn't using a port
adb kill-server
# smartphone is connected
adb wait-for-device
;;
esac
# Reload module (with right arguments)
sudo modprobe -r v4l2loopback
sudo modprobe v4l2loopback exclusive_caps=1
# Ensure audio is connected to increase the volume
sleep 10 && pacmd set-source-volume ipwebcam.monitor 65863 &
# Start video and audio
case "$1" in
wifi)
# with wifi
eval "$WEBCAM --use-wifi XXX.XXX.X.XX"
;;
*)
# with usb
eval "$WEBCAM"
;;
esac
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment