blob: 1e64593fd449d60761c51fbf0ee5945b714081b6 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
#!/bin/sh
caffeine
FRAMERATE="$2"
RESOLUTION="$1"
DEVICE="/dev/$(readlink /dev/v4l/by-id/usb-MACROSILICON_USB_Video-* | head -n1 | cut -c7-)"
CAPTURE_FL="$(pw-link -oI | grep 'usb-MACROSILICON_USB_Video-.*:capture_AUX0' | cut -f3 -d' ')"
CAPTURE_FR="$(pw-link -oI | grep 'usb-MACROSILICON_USB_Video-.*:capture_AUX1' | cut -f3 -d' ')"
DEFAULT_SINK_ALIAS="$(pw-metadata 0 default.audio.sink | grep -Po "value:'(.*?)'" | head -c-2 | cut -c8- | jq --raw-output .name)"
OUTPUT_FL="$(pw-link -iI | grep "$DEFAULT_SINK_ALIAS:playback_FL" | cut -f3 -d' ')"
OUTPUT_FR="$(pw-link -iI | grep "$DEFAULT_SINK_ALIAS:playback_FR" | cut -f3 -d' ')"
echo "link $CAPTURE_FR -> $OUTPUT_FR"
echo "link $CAPTURE_FL -> $OUTPUT_FL"
pw-link "$CAPTURE_FL" "$OUTPUT_FL"
pw-link "$CAPTURE_FR" "$OUTPUT_FR"
mpv --demuxer-lavf-format=video4linux2 \
--demuxer-lavf-o-set=input_format=mjpeg,framerate="$FRAMERATE",resolution="$RESOLUTION" \
--cache=no \
--pause=no \
--force-seekable=no \
--no-osc \
--no-input-default-bindings \
"av://v4l2:$DEVICE"
# &> /dev/null & disown
pw-link -d "$CAPTURE_FL" "$OUTPUT_FL"
pw-link -d "$CAPTURE_FR" "$OUTPUT_FR"
|