35 lines
764 B
Bash
Executable File
35 lines
764 B
Bash
Executable File
#!/bin/bash
|
|
|
|
QUALITY=28
|
|
|
|
if ! command -v slop &> /dev/null
|
|
then
|
|
echo "slop command not found. Please install slop."
|
|
exit 1
|
|
fi
|
|
|
|
if [ -z "$1" ]; then
|
|
echo "Usage: $0 <output.mp4>"
|
|
exit 1
|
|
fi
|
|
|
|
filename="$1"
|
|
|
|
echo "Select the desktop area to record."
|
|
coords=$(slop -f "%x %y %w %h" 2>/dev/null)
|
|
|
|
x=$(echo $coords | awk '{print $1}')
|
|
y=$(echo $coords | awk '{print $2}')
|
|
width=$(echo $coords | awk '{print $3}')
|
|
height=$(echo $coords | awk '{print $4}')
|
|
|
|
width=$((width / 2 * 2))
|
|
height=$((height / 2 * 2))
|
|
|
|
echo "Recording started. Press 'q' to stop recording."
|
|
|
|
ffmpeg -f x11grab -loglevel quiet -s ${width}x${height} -i ${DISPLAY}+$x,$y \
|
|
-c:v libx264 -pix_fmt yuv420p -crf ${QUALITY} -preset ultrafast -f mp4 $filename
|
|
|
|
echo "Recording stopped."
|