summaryrefslogtreecommitdiff
path: root/bin/compress
blob: f1e06b5dc4019f11f6851a084e91a0fdc73ef366 (plain)
  1. #!/bin/sh
  2. set -eu
  3. INPUT=$1
  4. OUTPUT=${2:-${1%.*}.nut}
  5. case $INPUT in
  6. *.dv) DEINT=yadif;;
  7. esac
  8. case ${OUTPUT##*.} in
  9. nut) AENCODE="-codec:a flac"; VENCODE="-codec:v huffyuv";;
  10. mkv) AENCODE="-codec:a flac"; VENCODE="-codec:v libvpx-vp9 -lossless 1";;
  11. mp4) AENCODE="-codec:a libopus -b:a 192k"; VENCODE="-codec:v libx264 -crf 1";;
  12. webm) AENCODE="-codec:a libopus -b:a 192k"; VENCODE="-codec:v libvpx-vp9";;
  13. esac
  14. mkdir -p "$(dirname "$OUTPUT")"
  15. ffmpeg -hide_banner -threads auto -y -i "$INPUT" -vf ${DEINT:+$DEINT,}format=pix_fmts=yuv420p $AENCODE $VENCODE "$OUTPUT"