Bash Script to convert FLAC album to Ogg Vorbis (preserving tags)
Hi,
I wrote this simple bash script that you might find useful if you have all your music stored in FLAC but wish to convert some of it to Ogg Vorbis for use on your mobile music player. I call the script OggEncodeAFLACAlbum.sh Here is the contents: #!/bin/bash if [ $# -lt 1 ]; then echo " " echo "Please supply artist/albumname as argument, e.g. abba/gold" else SRC_DIR=/music/flac/$1 if [ -d "$SRC_DIR" ]; then echo " " echo "Will Ogg encode the album $1 " echo "from " echo "$SRC_DIR" echo "to " DEST_DIR=/music/ogg/q6/$1 echo $DEST_DIR echo " " if [ -d "$DEST_DIR" ]; then echo "Destination already exists, will do nothing." else echo "Ogg encoding album $1 please wait..." mkdir -p $DEST_DIR cd $SRC_DIR for i in *.flac; do oggenc -q6 -o $DEST_DIR/${i%%flac}ogg $i; done fi else echo "Source directory $SRC_DIR does not exist, doing nothing." fi fi echo "Finished." HTH someone. |
saving for study - never know when you'll find a good nugget of info.
|
This is neat.
Note that spaces in the filenames will cause oggenc to complain about multiple files. Wrapping both the destination argument and the file argument in quotes will fix that. Code:
for i in *.flac; do oggenc -q6 -o "$DEST_DIR/${i%%flac}ogg" "$i"; done |
All times are GMT -5. The time now is 02:52 AM. |