userspace-installation-maid/.local/bin/ffmpeg-util

33 lines
654 B
Bash
Executable File

#!/bin/sh
if [ -z $(which ffmpeg) ]
then
echo "Missing ffmpeg package, please install it!"
exit 1
fi
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
ffmpeg -i "$2" -vcodec libx264 -crf 20 -filter:v fps=30 "$3"
fi
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
fi