Convert m4a to mp3 (or any FFMPEG conversion – Modify accordingly)

root@colinbsd2:/usr/home/colin # cat /mnt/ipod/iPod_Control/Music/m4aTomp3sh
#!/bin/sh
if [ -z $1 ];then echo Give target directory; exit 0;fi

find “$1” -depth -name ‘*’| while read file ; do
directory=$(dirname “$file”)
oldfilename=$(basename “$file”)
newfilename=$(basename “${file%.[Mm][4][Aa]}”)
if [ “$oldfilename” != “$newfilename” ]; then
ffmpeg -i “$directory/$oldfilename” -ab 320k “$directory/$newfilename.mp3”

Leave a Reply

Your email address will not be published. Required fields are marked *