Created
November 13, 2024 11:01
-
-
Save marcelarie/080d674c3dcf2e742a1b7c221a809cd4 to your computer and use it in GitHub Desktop.
Show webcam (Wayland)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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