Thursday, November 18, 2010

Convert all files in folder from ape to wav

Convert all files in a folder from ape to wav in Arch
Example of a batch conversion script

First install mac by doing
sudo pacman -S mac

Copy the text below in a text file, call it ape2wav and make it executable (chmod 755 it)

#! /bin/bash
cd $1 # change to the directory we passed as a parameter
for a in *.ape; do # only process ape files
if [ -f "$a" ]; then # is it a file? We _could_ have a me.ape directory
b="${a%.ape}" #set b to filename only
mac "${b}.ape" "${b}.wav" -d
fi
done

Put in /usr/bin. Now doing ape2wav /home/paul/apefolder will extract the audiofiles to wav. Of course change user and folder name.

Another example flv2mp3:
#! /bin/bash
cd $1 # change to the directory we passed as a parameter
for a in *.flv; do # only process flv files
if [ -f "$a" ]; then # is it a file? We _could_ have a me.flv directory
b="${a%.flv}" #set b to filename only
ffmpeg -i "${b}.flv" "${b}.mp3"
fi
done

No comments:

Blog Archive