Skip to content

Instantly share code, notes, and snippets.

@dermesser
Created December 27, 2012 11:50
Show Gist options
  • Save dermesser/4387687 to your computer and use it in GitHub Desktop.
Save dermesser/4387687 to your computer and use it in GitHub Desktop.
Little bash script to clean up file names of ogg files and transcode them to 64 kbit/s for my phone
#!/bin/bash
# Usage:
#
# Go to the directory you want to contain the transcoded files and
# call this script: $ downcode.sh /path/to/ogg/files/to/be/transcoded
# The transcoded ogg files containing the old tags are placed in $PWD.
# --> Spaces are replaced by underscores (_) in both the file names of the
# ogg files being transcoded and the new ogg files!
rename 's/ /_/g' $1/*.ogg
OGGFILES=`find $1 -name '*.ogg'`
for FILE in $OGGFILES;
do
oggdec -o temp.wav $FILE
oggenc -q0 -o `basename $FILE` temp.wav
rm temp.wav;
vorbiscomment -l $FILE | vorbiscomment -w `basename $FILE`
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment