Created
August 20, 2025 15:12
-
-
Save adsr/b3a696deea9730a12c5db743940f651f to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| #!/bin/bash | |
| set -euo pipefail | |
| cleanup() { | |
| test -n "$tmpf" && rm -f "$tmpf" | |
| } | |
| main() { | |
| trap cleanup EXIT | |
| tmpf="$(mktemp --suffix .png)" | |
| while true; do | |
| ffmpeg -y -f v4l2 -video_size 1280x720 -i /dev/video0 -update 1 -frames:v 1 "$tmpf" &>/dev/null | |
| out=$(ZXingReader -format QRCode -bytes "$tmpf" || true) | |
| test -n "$out" && xclip -sel c <<<"$out" && echo Copied && exit | |
| sleep 1 | |
| done | |
| } | |
| main "$@" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment