Skip to content

Instantly share code, notes, and snippets.

@kinjouj
Last active June 8, 2025 14:06
Show Gist options
  • Save kinjouj/5d9aed1ca7d6bda5899c81d3714ee349 to your computer and use it in GitHub Desktop.
Save kinjouj/5d9aed1ca7d6bda5899c81d3714ee349 to your computer and use it in GitHub Desktop.
ffmpegで矩形範囲を録画・録音する方法
#!/bin/bash
SLOP=$(slop -q -f "%x %y %w %h") || exit 1
read -r X Y W H G ID < <(echo $SLOP)
ffmpeg -threads 0 -y -f x11grab \
-s "$W"x"$H" \
-i :0.0+$X,$Y \
-f alsa \
-i default \
-c:v libx264 \
-c:a aac \
-ac 2 \
-r 60 \
-qp 15 \
-crf 23 \
-preset ultrafast \
-fs 128M \
out.mp4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment