main dots / config / .local / bin / webcamimg
xxwhirlpool  ·  2026-08-22
 1#!/usr/bin/env bash
 2
 3# check if it's running anywhere else but laptop
 4if [[ "$(hostname)" != "mariposa" ]]; then
 5	echo "only works on your laptop, dumbass"
 6	exit 1
 7fi
 8
 9# vars
10PICPATH="/home/kat/Pictures/Camera/webcam"
11# PIC="$PICPATH/webcam_pic_$(today time)_%3d.jpeg"
12PIC="$PICPATH/webcam_pic_$(today time)"
13
14# turn on webcam for a bit so the brightness isn't fucked
15echo -e "starting camera, wait 5s\n"
16timeout 5s v4l2-ctl --silent -d /dev/video0 -d0 --stream-mmap
17
18# take the pic
19echo -e "taking the pics!\n"
20ffmpeg -f video4linux2 -i /dev/video0 -vframes 3 -video_size 1920x1080 "$PIC-%3d.jpeg" -hide_banner -loglevel error
21
22# print the paths to pics
23echo -e "here's your pics!\n"
24realpath "$PIC-001.jpeg"
25realpath "$PIC-002.jpeg"
26realpath "$PIC-003.jpeg"