diff options
author | lonkaars <loek@pipeframe.xyz> | 2022-10-15 13:14:31 +0200 |
---|---|---|
committer | lonkaars <loek@pipeframe.xyz> | 2022-10-15 13:14:31 +0200 |
commit | a575b510fa46505aeef8828baa8ccbaec6d62e84 (patch) | |
tree | 7d42cb945f231a1c664f570ccdce1ae5818f8ddb | |
parent | 741f952517f867a3b8c4b03c933035ff2c28f8fe (diff) |
add janky stuff to screen share script for playing capture card audio through pipewire
-rwxr-xr-x | .local/share/bin/ccpreview | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/.local/share/bin/ccpreview b/.local/share/bin/ccpreview index 158541b..7ad19b4 100755 --- a/.local/share/bin/ccpreview +++ b/.local/share/bin/ccpreview @@ -6,6 +6,18 @@ 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_FL' | cut -f3 -d' ')" +CAPTURE_FR="$(pw-link -oI | grep 'usb-MACROSILICON_USB_Video-.*:capture_FR' | 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 \ @@ -15,3 +27,6 @@ mpv --demuxer-lavf-format=video4linux2 \ --no-input-default-bindings \ "av://v4l2:$DEVICE" # &> /dev/null & disown + +pw-link -d "$CAPTURE_FL" "$OUTPUT_FL" +pw-link -d "$CAPTURE_FR" "$OUTPUT_FR" |