2024-02-05 03:30:51 -05:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
if [ ! -z $1 ]
|
|
|
|
then
|
|
|
|
if [ $1 == 'cut' ]
|
|
|
|
then
|
|
|
|
ffmpeg -i "$2" -ss $3 -t $4 -c:v copy -c:a copy "$5"
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ $1 == 'shrink' ]
|
|
|
|
then
|
2024-02-21 15:09:41 -05:00
|
|
|
ffmpeg -i "$2" -vcodec libx264 -crf 15 -filter:v fps=25 -s 1280x720 -c:a copy "$3"
|
2024-02-05 03:30:51 -05:00
|
|
|
fi
|
2024-02-10 07:10:05 -05:00
|
|
|
|
|
|
|
if [ $1 == 'record' ]
|
|
|
|
then
|
2024-02-21 15:09:41 -05:00
|
|
|
device_id=$(pactl list short sources | grep output | awk '{print $1}')
|
|
|
|
if [ $2 == 'mic' ]
|
|
|
|
then
|
|
|
|
microphone_id=$(pactl list short sources | grep input | awk '{print $1}')
|
|
|
|
ffmpeg -framerate 25 -f x11grab -i :0.0 -f pulse -ac 2 -i $device_id -f pulse -ac 2 -i $microphone_id -filter_complex "[1:0][2:0]amix=inputs=2:duration=shortest" ~/Videos/$(date "+%F-%N").mkv &
|
|
|
|
else
|
|
|
|
ffmpeg -framerate 25 -f x11grab -i :0.0 -f pulse -ac 2 -i $device_id ~/Videos/$(date "+%F-%N").mkv &
|
|
|
|
fi
|
2024-02-10 07:10:05 -05:00
|
|
|
echo "$!" > ~/.local/share/ffmpeg/recent-recording
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ $1 == 'stop' ]
|
|
|
|
then
|
|
|
|
kill $(cat ~/.local/share/ffmpeg/recent-recording)
|
|
|
|
fi
|
2024-02-17 22:17:50 -05:00
|
|
|
|
|
|
|
if [ $1 == 'cue' ]
|
|
|
|
then
|
|
|
|
shnsplit -f $2 $3
|
|
|
|
fi
|
2024-03-08 17:34:41 -05:00
|
|
|
|
|
|
|
if [ $1 == 'mpc' ]
|
|
|
|
then
|
|
|
|
if [ $2 == 'update' ]
|
|
|
|
then
|
|
|
|
mpc clear && systemctl --user restart mpd.service && sleep 5 && mpc update && mpc add / && mpc play
|
|
|
|
else
|
|
|
|
if [ $(mpc status %$2%) == 'off' ]; then mpc $2 on; else mpc $2 off; fi
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
2024-02-17 22:17:50 -05:00
|
|
|
else
|
|
|
|
echo "cut:"
|
|
|
|
echo "ffmpeg -i \$2 -ss \$3 -t \$4 -c:v copy -c:a copy \$5"
|
|
|
|
echo "shrink:"
|
2024-02-21 15:09:41 -05:00
|
|
|
echo "ffmpeg -i \$2 -vcodec libx264 -crf 15 -filter:v fps=25 -s 1280x720 -c:a copy\$3"
|
2024-02-17 22:17:50 -05:00
|
|
|
echo "record:"
|
|
|
|
echo "ffmpeg -framerate 25 -f x11grab -i :0.0 -f pulse -ac 2 -i 57 ~/Videos/\$(date \"+%F-%N\").mkv &"
|
|
|
|
echo "cue:"
|
|
|
|
echo "shnsplit -f \$2 \$3"
|
2024-02-05 03:30:51 -05:00
|
|
|
fi
|
|
|
|
|