41 lines
516 B
Bash
Executable file
41 lines
516 B
Bash
Executable file
#!/bin/bash
|
|
|
|
crf=${CRF:-25}
|
|
video_codec=${VIDEO_CODEC:-libsvtav1}
|
|
audio_codec=${AUDIO_CODEC:-libopus}
|
|
|
|
while getopts ":c:v:a:" opt; do
|
|
case $opt in
|
|
c)
|
|
crf=$OPTARG
|
|
;;
|
|
v)
|
|
video_codec=$OPTARG
|
|
;;
|
|
a)
|
|
audio_codec=$OPTARG
|
|
;;
|
|
\?)
|
|
echo "no such arg!"
|
|
exit 1
|
|
;;
|
|
esac
|
|
done
|
|
shift $((OPTIND-1))
|
|
|
|
if [ $# -eq 0 ]; then
|
|
echo "no file selected"
|
|
exit 1
|
|
fi
|
|
|
|
if ! [ -f $1 ]; then
|
|
echo "no such file"
|
|
exit 2
|
|
fi
|
|
|
|
ffmpeg \
|
|
-i $1 \
|
|
-crf $crf \
|
|
-c:v $video_codec \
|
|
-c:a $audio_codec \
|
|
${2:-out.$1}
|