Skip to content

Instantly share code, notes, and snippets.

@marcelarie
Created November 13, 2024 11:01
Show Gist options
  • Save marcelarie/080d674c3dcf2e742a1b7c221a809cd4 to your computer and use it in GitHub Desktop.
Save marcelarie/080d674c3dcf2e742a1b7c221a809cd4 to your computer and use it in GitHub Desktop.
Show webcam (Wayland)
#!/usr/bin/env bash
default_webcam=$(ls /dev/video* | head -n 1)
if [ -z "$1" ]; then
webcam_number=$default_webcam
else
webcam_number="/dev/video$1"
fi
if [ ! -e "$webcam_number" ]; then
echo "Error: Webcam device $webcam_number not found."
exit 1
fi
# plus flip image
gst-launch-1.0 -v v4l2src device="$webcam_number" ! video/x-raw,format=YUY2,width=640,height=480,framerate=30/1 ! videoconvert ! videoflip method=horizontal-flip ! autovideosink
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment