View Single Post
  #1   (View Single Post)  
Old 2nd August 2015
thomasw_ thomasw_ is offline
Real Name: thomas
Port Guard
Join Date: Feb 2013
Location: fort langley
Posts: 30
Question flac to alac script help


I have a problem with an audio conversion script -- from FLAC to ALAC.

I want to convert some of my library from FLAC to ALAC for ease of use on a Mac OSX box. I wrote a little script which works as expected on OSX just fine, but I'd like to know how I screwed up the script so that it doesn't run on OpenBSD 5.7. Both my OpenBSD 5.7 box and OSX box both use KSH for the shell. I get this error message on OpenBSD ...

/home/thomasw/bin/[6]: ${f/%flac/m4a}": bad substitution
... when running this script:

#script using ffmpeg to convert FLAC to ALAC and use AtomicParsley to #merge the cover.jpg into the converted ALAC files.

for f in *.flac; do ffmpeg -i "$f" -vf "crop=((in_w/2)*2):((in_h/2)*2)" -c:a alac "${f/%flac/m4a}" "${f/%flac/jpg}" && \
AtomicParsley "${f/%flac/m4a}" --artwork "${f/%flac/jpg}" --overWrite && \
rm "${f/%flac/jpg}"; done
I know a simple answer would be to use the script on OSX, but my entire audio library is on OpenBSD and copying the FLACs to run the script on the OSX is a tiresome task I'd like to avoid.

If anyone can hit me with a cluebat I'd appreciate it.

Thanks in advance --

Reply With Quote