dots/.bin/cast

43 lines
1.3 KiB
Bash
Executable File

#! /bin/bash
sudo nvidia-settings --assign="0/AllowFlipping=0" &>/dev/null
RES=$(xdpyinfo | grep dimensions | awk '{print $2;}')
ALSA_OUT="alsa_output.pci-0000_00_14.2.analog-stereo.monitor"
if [ "$1" = "-m" ]; then
ffmpeg \
-f x11grab -s $RES -i :0.0 \
-f alsa -i default \
-c:v libx264 -pix_fmt yuv420p -r 30 -crf 23 -preset superfast -threads 0 \
-c:a aac \
-y ~/Videos/output.mkv
elif [ "$1" = "-n" ]; then
ffmpeg \
-f x11grab -s $RES -i :0.0 \
-c:v libx264 -pix_fmt yuv420p -r 30 -preset superfast -qp 0 \
-y ~/Videos/output.mp4
elif [ "$1" = "-s" ]; then
slop=$(slop -f "%x %y %w %h %g %i") || exit 1
read -r X Y W H G ID < <(echo $slop)
ffmpeg \
-f x11grab -s "$W"x"$H" -i :0.0+$X,$Y \
-f pulse -i $ALSA_OUT \
-c:v libx264 -pix_fmt yuv420p -r 30 -crf 23 -preset superfast -qp 0 \
-y ~/Videos/output.mp4
# elif [ "$1" = "-g" ]; then
# slop=$(slop -f "%x %y %w %h %g %i") || exit 1
# read -r X Y W H G ID < <(echo $slop)
# ffmpeg \
# -f x11grab -s "$W"x"$H" -i :0.0+$X,$Y \
# -c:v gif \
# -y ~/Videos/output.gif
else
ffmpeg \
-f x11grab -video_size $RES -i :0.0 \
-f pulse -i $ALSA_OUT \
-c:a libvorbis -b:a 128k \
-c:v libx264 -pix_fmt yuv420p -crf 23 -preset superfast -s 1920x1080 -r 30 \
-y ~/Videos/output.mp4
fi