2024-02-05 03:30:51 -05:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
if [ -z $(which ffmpeg) ]
|
|
|
|
then
|
|
|
|
echo "Missing ffmpeg package, please install it!"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2024-02-17 22:17:50 -05:00
|
|
|
if [ -z $(which shnsplit) ]
|
|
|
|
then
|
|
|
|
echo "Missing shntool package, please install it!"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2024-02-05 03:30:51 -05:00
|
|
|
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-17 22:17:50 -05:00
|
|
|
ffmpeg -i "$2" -vcodec libx264 -crf 20 -filter:v fps=25 "$3"
|
2024-02-05 03:30:51 -05:00
|
|
|
fi
|
2024-02-10 07:10:05 -05:00
|
|
|
|
|
|
|
if [ $1 == 'record' ]
|
|
|
|
then
|
|
|
|
ffmpeg -framerate 25 -f x11grab -i :0.0 -f pulse -ac 2 -i 57 ~/Videos/$(date "+%F-%N").mkv &
|
|
|
|
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
|
|
|
|
else
|
|
|
|
echo "cut:"
|
|
|
|
echo "ffmpeg -i \$2 -ss \$3 -t \$4 -c:v copy -c:a copy \$5"
|
|
|
|
echo "shrink:"
|
|
|
|
echo "ffmpeg -i \$2 -vcodec libx264 -crf 20 -filter:v fps=25 \$3"
|
|
|
|
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
|
|
|
|
|