summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xbin/compress20
1 files changed, 20 insertions, 0 deletions
diff --git a/bin/compress b/bin/compress
new file mode 100755
index 0000000..f1e06b5
--- /dev/null
+++ b/bin/compress
@@ -0,0 +1,20 @@
+#!/bin/sh
+
+set -eu
+
+INPUT=$1
+OUTPUT=${2:-${1%.*}.nut}
+
+case $INPUT in
+ *.dv) DEINT=yadif;;
+esac
+
+case ${OUTPUT##*.} in
+ nut) AENCODE="-codec:a flac"; VENCODE="-codec:v huffyuv";;
+ mkv) AENCODE="-codec:a flac"; VENCODE="-codec:v libvpx-vp9 -lossless 1";;
+ mp4) AENCODE="-codec:a libopus -b:a 192k"; VENCODE="-codec:v libx264 -crf 1";;
+ webm) AENCODE="-codec:a libopus -b:a 192k"; VENCODE="-codec:v libvpx-vp9";;
+esac
+
+mkdir -p "$(dirname "$OUTPUT")"
+ffmpeg -hide_banner -threads auto -y -i "$INPUT" -vf ${DEINT:+$DEINT,}format=pix_fmts=yuv420p $AENCODE $VENCODE "$OUTPUT"