feat: shrink video experiment
This commit is contained in:
parent
fea826d17a
commit
cb88aebeef
2 changed files with 43 additions and 0 deletions
2
experiments/shrink-video/.gitignore
vendored
Normal file
2
experiments/shrink-video/.gitignore
vendored
Normal file
|
@ -0,0 +1,2 @@
|
|||
*.webm
|
||||
|
41
experiments/shrink-video/shrink.sh
Executable file
41
experiments/shrink-video/shrink.sh
Executable 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}
|
Loading…
Reference in a new issue