]> gitweb.hhaalo.de Git - albentohandy.git/commitdiff
add: flac to vorbis script
authorBastian Dehn <hhaalo@arcor.de>
Sun, 20 Jan 2019 11:50:34 +0000 (12:50 +0100)
committerBastian Dehn <hhaalo@arcor.de>
Sun, 20 Jan 2019 11:53:27 +0000 (12:53 +0100)
flactovorbis [new file with mode: 0755]

diff --git a/flactovorbis b/flactovorbis
new file mode 100755 (executable)
index 0000000..21c5319
--- /dev/null
@@ -0,0 +1,32 @@
+#!/bin/bash
+
+ReadFlacToOggTags()
+{
+       local readonly INPUTFILE="$1"
+       local readonly OUTPUFILE="$2"
+
+       metaflac --export-tags-to=- $INPUTFILE \
+               | vorbiscomment -c - -w $OUTPUTFILE
+}
+
+EncodingFlacToOgg()
+{
+       local readonly INPUTFILE="$1"
+       local readonly OUTPUTFILE="$2"
+
+       # stream flac into the ogg vorbis
+       nice --adjustment=10 flac --silent --stdout --decode "$INPUTFILE" \
+               | nice --adjustment=15 oggenc -q 6 -o "$OUTPUTFILE" -
+}
+
+main()
+{
+       local readonly INPUTFILE="$1"
+       local readonly OUTPUTFILE="${INPUTFILE[@]/%flac/ogg}"
+
+       EncodingFlacToOgg "$INPUTFILE" "$OUTPUTFILE"
+       ReadFlacToOggTags "$INPUTFILE" "$OUTPUTFILE"
+}
+
+main "$1"
+exit 0