[LAU] No ffmpeg, help convert script for Sox

Kazakore dj_kaza at hotmail.com
Tue Nov 18 09:27:45 UTC 2014


Well that was a surprise, to see that ffmpeg has been fully removed from 
Ubuntu now. Not sure how much of a better move that is, compared to the 
very underhand tactics of having it a renamed package which in reality 
had nothing to do with real ffmpeg. Not sure I want to get into the 
politics of the situation here though, sure most of you know far more 
than I do!

Anyway I have a little script for batch converting flacs to mp3s as I am 
rather space conscience while travelling and my mp3 player never liked 
ogg. My Bash skills are near zero and what I have working is messy from 
searching on the internet for a solution. Hopefully you can help me 
modify it to use Sox rather than ffmpeg. (And possibly make it so I can 
simply call the command, rather than the more complex command I have to 
use currently.)

To start the process I currently use this command in the terminal:
find  -type d -exec ~/bin/flac2mp3 "{}" \;

The previously working contents of flac2mp3 was:
#!/bin/bash
if [ -d "${1}" ] ; then
   cd "${1}" && for f in *.flac; do ffmpeg -i "$f" -f wav - | lame -b 
320 -m j -q 0 - "${f%.flac}.mp3"; done
fi

I tried quickly to edit.

#!/bin/bash
if [ -d "${1}" ] ; then
   cd "${1}" && for f in *.flac; do sox "$f" -b 16 "${f%.flac}.wav" - | 
lame -b 320 -m j -q 0 - "${f%.flac}.mp3"; done
fi

Seems to think the .wav is an incoming file for concatenation.

#!/bin/bash
if [ -d "${1}" ] ; then
   cd "${1}" && for f in *.flac; do sox "$f" -b 16 "${f%.flac}.wav" | 
lame -b 320 -m j -q 0 - "${f%.flac}.mp3"; done
fi

Gives me all the wav files converted but doesn't then pass them onto the 
lame section of the command.


I'm sure this must be really simple! (As much having it all in one 
single script called by just executing the file!)


Regards, Dale.


More information about the Linux-audio-user mailing list