Skip to content

Instantly share code, notes, and snippets.

@ktzar
Created July 13, 2017 14:52
Show Gist options
  • Save ktzar/7cfb2985370aa97a00b04c44608f706c to your computer and use it in GitHub Desktop.
Save ktzar/7cfb2985370aa97a00b04c44608f706c to your computer and use it in GitHub Desktop.
Audio conversion tools
#!/bin/bash
BITRATE=64
OUTDIR="."
if [ "$1" != "" ]; then
BITRATE=$1
fi
if [ "$2" != "" ]; then
OUTDIR=$2
fi
echo "Encoding with bitrate ${BITRATE} in ${OUTDIR}"
for file in *.mp3 ; do
FILE=`basename "${file}" .mp3`
OUTFILE="$OUTDIR/$FILE.ogg"
avconv -i "$file" -f wav -map_metadata 0 - | opusenc --bitrate $BITRATE - "$OUTFILE"
done;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment