screen capture script

I’m trying to conceptualize how big of an area to capture without actually drawing a picture and doing math on paper. Why is this harder?

I want to capture the center of the screen, a window of arbitrary size.

RESOLUTION=$(xrandr --current | grep '\*' | awk '{print $1}')
[[ "${RESOLUTION}" =~ ([0-9]+)x([0-9]+) ]] || exit 1
RES_X=${BASH_REMATCH[1]}
RES_Y=${BASH_REMATCH[2]}
D_W=$((RES_X/4))
D_H=$((RES_Y/4))

OFF_X=$((RES_X/2 - D_W/2))
OFF_Y=$((RES_Y/2 - D_H/2))

ffmpeg -video_size "${D_W}x$(D_H}" -framerate 25 -f x11grab -i :0.0+${OFF_X},${OFF_X} output.mp4

Tags

=> #cli

Navigation

=> index | tags

created: 2023-02-17

(re)generated: 2025-01-29

Proxy Information
Original URL
gemini://thatit.be/2023-02-17-06-29-31.gmi
Status Code
Success (20)
Meta
text/gemini
Capsule Response Time
507.180961 milliseconds
Gemini-to-HTML Time
0.387673 milliseconds

This content has been proxied by September (3851b).