[LAU] No ffmpeg, help convert script for Sox

Kazakore dj_kaza at hotmail.com
Tue Nov 18 13:24:56 UTC 2014


On 18/11/14 18:33, F. Silvain wrote:
> Kazakore, Nov 18 2014:
> ...
>> 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
> Why not install flac, if it isn't installed already and change your 
> ffmpeg command in that line to:
> flac -d -o - $f | lame ...
> the rest as before. You might need to add the quiet/silent option for 
> flac, depending on your version of lame.
Flac wasn't installed so I have just done so and get this error.

ERROR: -o/--output-name cannot be used with multiple files

Slight adjustment and I can get it to generate the wav files, same as 
with Sox, but then it stops... And a bit more reading of Help and think 
I have it. Also needed the send to stdout flag (-c) set, rather than 
writing to file.

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

Strangely it now shows me progress of flac conversion (IE percentage 
complete) but not the lame/mp3. Sure it used to be the other way around. 
But it does inform me it passes it on to LAME and the settings. Anybody 
know what the 4.4x part relates to?

Encoding as 44.1 kHz j-stereo MPEG-1 Layer III (4.4x) 320 kbps qval=0



As to why I initially chose Sox. I knew it was installed and is a very 
powerful and useful program to learn from what I understand, so thought 
if it is suitable for the job it would be one worth attempting to 
achieve it with. I have known it be used at companies I have worked for 
to transcode, or more often combine and mix down audio streams. A 
regular example would be taking the four audio channels you get on most 
professional camcorders and many location recorders and mixing them down 
to two channels for normal use. Therefore it is a tool I would like to 
familiarise myself with more :-)



Anyway that appears to have completed now and the mp3s are sounding fine 
(well perfectly acceptable to my ears from my laptop at least.) Thanks 
for the pointer, and I'll look to see if there is a stdout option for 
Sox as guess that is what was needed there too :)

Dale.


More information about the Linux-audio-user mailing list