[LAU] No ffmpeg, help convert script for Sox

Kazakore dj_kaza at hotmail.com
Wed Nov 19 01:07:43 UTC 2014


On 18/11/14 23:19, Rob wrote:
> On 11/18/2014 04:27 AM, Kazakore wrote:
>> Well that was a surprise, to see that ffmpeg has been fully removed from
>> Ubuntu now. [...]
>> Anyway I have a little script for batch converting flacs to mp3s [...]
>> Hopefully you can help me modify
>> it to use Sox rather than ffmpeg.
> Or you can just add real ffmpeg back in, as many of us have been doing for
> about 3 years now. If they've finally removed their fake ffmpeg package,
> that will actually make things less complicated (and maybe open the door to
> restoring big-boy ffmpeg over the objections of the butthurt avconv
> motherforkers).
>
> https://launchpad.net/~jon-severinsson/+archive/ubuntu/ffmpeg

The original script is from when I was running 12.04 and I did have 
avconv replaced with the original ffmpeg then and I know I could have 
gone that route again. But knowing there are other tools that can do the 
job and not feeling quite settled with US14.04 at the moment (been 
meaning to install and try out a couple of others for ages now but 
finding the time while travelling can be hard) so have purposely kept 
the repositories as vanilla as possible this time.
>
> As for making it work without the find command, try something like this:
>
> #!/bin/bash
> for d in "$@"; do
> if [ -d "$d" ] ; then
>    cd "${1}" && for f in *.flac; do ffmpeg -i "$f" -f wav - | lame -b 320 -m
> j -q 0 - "${f%.flac}.mp3"; done
> elif [ -f "$d" ]; then
>    ffmpeg -i "$d" -f wav - | lame -b 320 -m j -q 0 - "${f%.flac}.mp3";
> fi
> done
>
> Easy enough to put the find command right in the script, too, if you need
> to do it recursively.

Recursive operation was a must for the first time I used it, now I have 
processed my existing files it has become not so important.
>
> But what's wrong with encoding to mp3 with ffmpeg directly? Personally, I
> just do something like
>
> ffmpeg -i "$1" -b 320 `basename $1 .flac`.mp3
Maybe I'm just being anal but I don't like the fact that standard 320 
uses stereo of 160kbs per side, so I want to force joint stereo mode 
(especially as a lot of my music is electronic with less stereo 
separation than much live music) and set the quality to at least -h/-q2, 
if not the -q0 I am currently using (and still seems to be quicker than 
the flac>wav process and therefore unnoticeable in adding processing 
time as it is piped in and converted as a stream.)
>
> And when I want to copy tags over, I just use flac2mp3:
>
> https://github.com/robinbowes/flac2mp3
>
> Rob
>
> _

Did consider looking for an existing tool so I can save the tags, as you 
mention, but they rarely seem to give access to all the lame options I 
desire and I thought this was a good script to help get my head at least 
a little around Bash.

Dale.


More information about the Linux-audio-user mailing list