diff options
author | Jonas Smedegaard <dr@jones.dk> | 2017-05-18 14:03:34 +0200 |
---|---|---|
committer | Jonas Smedegaard <dr@jones.dk> | 2017-05-18 14:03:34 +0200 |
commit | f29540d0eb313883ab5954f09e9b361ff7a943ca (patch) | |
tree | e6e0893820218cad78f3eb4022b69a2de16cd90a | |
parent | 56b7655e67528880778696d32f2d3a3e3ff30782 (diff) |
Add script compress.
-rwxr-xr-x | bin/compress | 20 |
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" |