1
0
Fork 0

feat: shrink video experiment

This commit is contained in:
Strix 2024-01-14 20:56:41 +01:00
parent fea826d17a
commit cb88aebeef
No known key found for this signature in database
GPG key ID: 5F35B3B8537287A7
2 changed files with 43 additions and 0 deletions

2
experiments/shrink-video/.gitignore vendored Normal file
View file

@ -0,0 +1,2 @@
*.webm

View file

@ -0,0 +1,41 @@
#!/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}