💾 Archived View for thatit.be › 2023-02-17-06-29-31.gmi captured on 2023-09-08 at 16:23:05. Gemini links have been rewritten to link to archived content

View Raw

More Information

⬅️ Previous capture (2023-06-14)

➡️ Next capture (2023-09-28)

🚧 View Differences

-=-=-=-=-=-=-

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

updated: 2023-04-20 12:46:34 -0400

generated: 2023-08-19