Setting webcam

Your webcam is located in /dev/video*.

mpv --title=webcam-from-b-sothea --input-cursor=no --osd-level=0 av://v4l2:/dev/video2 --demuxer-lavf-o=pixel_format=mjpeg --profile=low-latency --untimed

Moreover in swaywm, we can make it so that when lauching mpv with a certain title, we can configure it to be sticky, float, and put with a certain coordinate. In your sway/config

for_window [app_id="mpv" title=webcam"] \
    floating enable, \
    sticky enable, \
    resize set 30 ppt 30 ppt, \
    move position 70 ppt 70 ppt

Below is a shell script to automate this: (require bemenu)

#!/bin/sh

DEVICE=$(ls /dev/video* | bemenu  -p "choose video: " --hp 10 -H 20 )

if [ -n "$DEVICE" ]; then
    mpv --title=webcam\
	--input-cursor=no\
	--osd-level=0 \
	--demuxer-lavf-o=pixel_format=mjpeg\
	--profile=low-latency --untimed\
	av://v4l2:$DEVICE
fi