shadowm

Untitled

Feb 19th, 2013
162
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.56 KB | None | 0 0
  1. #!/bin/sh
  2.  
  3. die() { echo >&2 "$@"; exit 1; }
  4.  
  5. [ $# -eq 3 ] || die "Syntax: $0 <input file> <output file> <vbr quality factor>"
  6.  
  7. [ -e "$1" ] || die "Input file does not exist: $1"
  8.  
  9. IN=`readlink -e $1`
  10. OUT=$2
  11. QFACTOR=$3
  12.  
  13. [ "$IN" = "$OUT" ] && die "Input file cannot be the same as the output file!"
  14.  
  15. COMMENTS="${IN}.comments"
  16. PCM="${IN}.wav"
  17.  
  18. vorbiscomment -l $IN > $COMMENTS
  19.  
  20. ( oggdec -o $PCM $IN && oggenc -q $QFACTOR -o $OUT $PCM ) || die "Recoding failed!"
  21.  
  22. vorbiscomment -w $OUT -c $COMMENTS || die "Could not restore comments!"
  23.  
  24. rm $PCM $COMMENTS
Advertisement
Add Comment
Please, Sign In to add comment