Skip to content

Instantly share code, notes, and snippets.

@lidgnulinux
Created October 8, 2025 10:38
Show Gist options
  • Save lidgnulinux/6e725570ad12c17862f064a73f636896 to your computer and use it in GitHub Desktop.
Save lidgnulinux/6e725570ad12c17862f064a73f636896 to your computer and use it in GitHub Desktop.
Record focused window using ffmpeg.
#!/bin/bash
position=$(xdotool getwindowfocus getwindowgeometry | grep Posit | awk '{print $2}')
ffmpeg -f x11grab \
-framerate 30 \
-video_size $1 \
-i ${DISPLAY}+$position \
-c:v libx264 \
-pix_fmt yuv420p \
$2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment