Skip to content

Instantly share code, notes, and snippets.

@gammy
Last active August 29, 2015 14:17
Show Gist options
  • Select an option

  • Save gammy/a1bf920b66f8dbd2e52c to your computer and use it in GitHub Desktop.

Select an option

Save gammy/a1bf920b66f8dbd2e52c to your computer and use it in GitHub Desktop.
advanced_webcam_dumper.bash
#!/bin/bash
while true; do
rm 000*.jpg
mplayer tv:// \
-tv driver=v4l2:device=/dev/video0:width=1280:height=720:outfmt=rgb24 \
-quiet \
-frames 3 \
-vo jpeg 2>&1 | grep frames
last=$(ls -rt *.jpg | tail -n1)
out=$(stat -c "%y" "$last")
echo -e "--------------------------------------\n$out"
convert "$last" \
-fill '#0008' -draw 'rectangle 0,0,225,14' \
-fill white -annotate +4+12 "$out" \
latest.jpg
sleep 2
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment