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

53 lines
1.1 KiB
Bash
Executable File

#!/bin/sh
if [ -z $(which ffmpeg) ]
then
echo "Missing ffmpeg package, please install it!"
exit 1
fi
if [ -z $(which shnsplit) ]
then
echo "Missing shntool 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=25 "$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
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"
fi