Converting FLAC to MP3 using ffmpeg

Posted by: Roger

Converting FLAC to MP3 using ffmpeg - 02/04/2016 20:18

My FLAC collection's on my Synology NAS, and that has ffmpeg installed. So I'm just gonna leave this here:

Code:
#!/bin/sh
# Put this in 'flac2mp3', chmod +x

source=$1
oldroot=$2
newroot=$3

scratch=${1%.flac}.mp3
dest=$newroot${scratch#$oldroot}

mkdir -p "$(dirname "$dest")"
ffmpeg -y -i "$source" -vn -acodec libmp3lame -q:a 2 "$dest"


Code:
find /volume1/flac -name '*.flac' -exec ./flac2mp3 {} /volume1/flac/ /volume1/music/ {} \;


Note: I've not actually tried it on the NAS, yet, but it seems to work OK on my Linux desktop. I'm going to play with the metadata settings next.
Posted by: andy

Re: Converting FLAC to MP3 using ffmpeg - 03/04/2016 16:05

I've always used:

https://github.com/robinbowes/flac2mp3

(it can do thing like just syncing the tags to already encoded MP3s)
Posted by: Roger

Re: Converting FLAC to MP3 using ffmpeg - 04/04/2016 08:52

That's useful, except that it requires me to cross-compile flac and lame for the diskstation. I'll have to dig into that.

Or, of course, I could patch it to run ffmpeg instead...
Posted by: andy

Re: Converting FLAC to MP3 using ffmpeg - 05/04/2016 08:26

I really should dig into it myself at some point, it still has some issues when it comes to creating MP3 tags that work well with iTunes (though it is much better than it was at one point, either that or iTunes has got more tolerant of oddities).