PDA

View Full Version : What's the best way to convert FLAC to MP3?



Aylwin
2005-06-16, 13:34
I've started ripping my CD collection to FLAC using EAC. At some point I'd like to batch convert some of the FLACs to MP3. What's the best way to go about this?

Thanks,
Aylwin

pfarrell
2005-06-16, 14:07
On Thu, 2005-06-16 at 13:34 -0700, Aylwin wrote:
> I've started ripping my CD collection to FLAC using EAC. At some point
> I'd like to batch convert some of the FLACs to MP3. What's the best
> way to go about this?

With a Perl program. I've got one you can start with
on my Slim software page
http://www.pfarrell.com/music/slimserver/slimsoftware.html

Look for the text:
a new, low functionality utlity in Perl to convert flac files to mp3,
called flac2mp3.pl

--
Pat
http://www.pfarrell.com/music/slimserver/slimsoftware.html

radish
2005-06-16, 14:26
One word of warning - if you have flac files with non-regular characters in the file names (like unicode) then a lot of scripts will choke on them. I had that exact problem, which I could only partly fix. In the end I found that using foobar2000 (on windows) was much easier, although I'd like to be able to run the process from the command line as part of my overall ripping scripts. :(

Aylwin
2005-06-16, 15:12
With a Perl program. I've got one you can start with
on my Slim software page
http://www.pfarrell.com/music/slimserver/slimsoftware.htmlCool! Thanks! I've never installed and run Perl on Windows before but I guess this is part of the fun.

street_samurai
2005-06-17, 13:12
Although I've never done it before. You might find it easier to use Foobar2000 (http://www.foobar2000.org/) and Lame to do this... as it doesn't require Perl and it has a GUI.

All you should need to do is add your flacs to the playlist, select all, right click and convert to MP3... then wait... a long... time.

ss.

Robin Bowes
2005-06-17, 17:12
Pat Farrell wrote:
> On Thu, 2005-06-16 at 13:34 -0700, Aylwin wrote:
>
>>I've started ripping my CD collection to FLAC using EAC. At some point
>>I'd like to batch convert some of the FLACs to MP3. What's the best
>>way to go about this?
>
>
> With a Perl program. I've got one you can start with
> on my Slim software page
> http://www.pfarrell.com/music/slimserver/slimsoftware.html
>
> Look for the text:
> a new, low functionality utlity in Perl to convert flac files to mp3,
> called flac2mp3.pl

Aha! I too have a utility named flac2mp3.pl which, surprisingly enough,
converts flac files to mp3 format.

I wrote it for exactly the same situation - I store all my music in flac
format and needed to convert it to mp3 for my iPod.

My goal was to write something that I could just point at a directory
tree full of flac files and have it mirrored into a corresponding
directory structure full of mp3 files. I also only want to convert those
files that need converting, i.e. newly-added files. Finally, I didn't
want to have to re-transcode a file if only the tags have changed, so I
added a tags-only mode.

One of these days I'll get round to writing some documentation, but at
least it's got usage instructions now:

# flac2mp3
Usage: flac2mp3 [--quiet] [--debug] [--tagsonly] [--force] <flacdir>
<mp3dir>
--quiet Disable informational output to stdout
--debug Enable debugging output. For developers only!
--tagsonly Don't do any transcoding - just update tags
--force Force transcoding and tag update even if not required

To use the script, you'll need the following:

flac
lame
Perl
Perl modules:
- Audio::FLAC::Header
- MP3::Tag

Caveat: I've only tested it on Linux (Fedora Core 3), but it should work
OK on Windows if you can get Audio::FLAC::Header installed.

flac2mp3 is currently available here:

http://robinbowes.com/filemgmt/viewcat.php?cid=4

R.
--
http://robinbowes.com

gorstk
2005-06-18, 09:34
Robin Bowes wrote:

> Aha! I too have a utility named flac2mp3.pl which, surprisingly enough,
> converts flac files to mp3 format.
>
> I wrote it for exactly the same situation - I store all my music in flac
> format and needed to convert it to mp3 for my iPod.
>
> My goal was to write something that I could just point at a directory
> tree full of flac files and have it mirrored into a corresponding
> directory structure full of mp3 files. I also only want to convert those
> files that need converting, i.e. newly-added files. Finally, I didn't
> want to have to re-transcode a file if only the tags have changed, so I
> added a tags-only mode.

Sounds as if it is just what I need!!
Just a few questions!

1) can I specify what quality MP3 output to use?
2) if there are MP3 files in the source directory, will it just copy
these to the output directory (this is the behavious I am looking for)

Cheers

gorstk
2005-06-19, 02:25
Robin Bowes wrote:

> flac
> lame
> Perl
> Perl modules:
> - Audio::FLAC::Header
> - MP3::Tag

I had a lot of difficulty installing audio::flac::header
CPAN would not install it for me. In the end I just copied the directory
audio directory from CPAN in slimserver to my perl cpan installation
which seemed to do the trick.

MP3::TAG installed easily from webmin CPAN perl module installer.

gorstk
2005-06-19, 02:47
John Gorst wrote:

>
> 1) can I specify what quality MP3 output to use?

I have figured out that I just need to edit line 94 and change the lame
preset option.
Maybe this should be a command line option?

> 2) if there are MP3 files in the source directory, will it just copy
> these to the output directory (this is the behavious I am looking for)

Unfortuently this does not seem to happen )-:
This is a shame as I am trying to replicate (automatically) my music
collection from my linux server to my laptop (with small hard disc)
running itune/mediaplayer.

Ideally it would copy accross all files, including ones it didnt
transcode e.g. album art and mp3/wma files.

Any ideas?

Maybe I could create a script which would replicate the whole directory
structure of my music collection and set it to copy accross /everything/
apart from flac files. I would then run flac2mp3 which would copy
accross the flac files as mp3.

Robin Bowes
2005-06-19, 12:37
John Gorst wrote:
> Robin Bowes wrote:
>
>> Aha! I too have a utility named flac2mp3.pl which, surprisingly
>> enough, converts flac files to mp3 format.
>>
>> I wrote it for exactly the same situation - I store all my music in
>> flac format and needed to convert it to mp3 for my iPod.
>>
>> My goal was to write something that I could just point at a directory
>> tree full of flac files and have it mirrored into a corresponding
>> directory structure full of mp3 files. I also only want to convert
>> those files that need converting, i.e. newly-added files. Finally, I
>> didn't want to have to re-transcode a file if only the tags have
>> changed, so I added a tags-only mode.
>
>
> Sounds as if it is just what I need!!
> Just a few questions!
>
> 1) can I specify what quality MP3 output to use?

As you've already found out, simply modify the array @lameargs to suit
your needs. As you can see from the comment immediately above, I have
made a note that a possible enhancement would be to specify that on the
command line.

> 2) if there are MP3 files in the source directory, will it just copy
> these to the output directory (this is the behavious I am looking for)

Again, as you've already found out, no it won't.

Just copy all your mp3s over and then run flac2mp3.

If I extend flac2mp3 to include "mirroring", i.e. delete any files found
in the target directory that don't have corresponding source files, then
I may consider adding mp3 copying.

I've set up a bunch of mail lists relating to flac2mp3.

Details are here:

http://robinbowes.com/article.php/20050611002827903

R.
--
http://robinbowes.com

Robin Bowes
2005-06-19, 12:37
John Gorst wrote:
> Robin Bowes wrote:
>
>> flac
>> lame
>> Perl
>> Perl modules:
>> - Audio::FLAC::Header
>> - MP3::Tag
>
>
> I had a lot of difficulty installing audio::flac::header
> CPAN would not install it for me. In the end I just copied the directory
> audio directory from CPAN in slimserver to my perl cpan installation
> which seemed to do the trick.

You can moan to Dan about that - it's his module!

>
> MP3::TAG installed easily from webmin CPAN perl module installer.

On what platform are you running this?

R.
--
http://robinbowes.com

gorstk
2005-06-20, 02:24
Robin Bowes wrote:

>> I had a lot of difficulty installing audio::flac::header
>> CPAN would not install it for me. In the end I just copied the
>> directory audio directory from CPAN in slimserver to my perl cpan
>> installation which seemed to do the trick.
>
>
> You can moan to Dan about that - it's his module!
>
>>
>> MP3::TAG installed easily from webmin CPAN perl module installer.
>
>
> On what platform are you running this?

Mandrake 10.1

gorstk
2005-06-20, 03:56
> Again, as you've already found out, no it won't.
>
> Just copy all your mp3s over and then run flac2mp3.
>
> If I extend flac2mp3 to include "mirroring", i.e. delete any files found
> in the target directory that don't have corresponding source files, then
> I may consider adding mp3 copying.

I have created a simple shell script to copy all files (excluding flac)
to the target directory and then run the flac2mp3 converter.

I created a file called copyandvert.sh into the directoty where all my
music is located (/home/john/Music for me) and gave it execute
priviliges to me.

The content of the file is:
find . -not -name "*.flac" -print | cpio -pvdu /home/john/converted/
flac2mp3 ./ /home/john/converted/

Obviously change /home/john/converted to the directory where you want
all your mp3's and converted flacs to be placed. Also add the path to
flac2mp3 (I have copied mine to /usr/bin/ therefore it doesnt need a path).

If I work out how to use cron, I should be able to set it up to run each
night.

I will also look into running lame with a lower nice value otherwise
things could get very slow on my server if the convert job extends into
the day time!

Sorry, this is linux specific I think.

>
> I've set up a bunch of mail lists relating to flac2mp3.
>
> Details are here:
>
> http://robinbowes.com/article.php/20050611002827903

crossposted to the the above mailing list, but figured more people would
read it here.

Cheers

robinbowes
2005-06-20, 05:35
John Gorst wrote:

>
>> Again, as you've already found out, no it won't.
>>
>> Just copy all your mp3s over and then run flac2mp3.
>>
>> If I extend flac2mp3 to include "mirroring", i.e. delete any files found in the target directory that don't have corresponding source files, then I may consider adding mp3 copying.
>
>
>
>
> I have created a simple shell script to copy all files (excluding flac) to the target directory and then run the flac2mp3 converter.
>
> I created a file called copyandvert.sh into the directoty where all my music is located (/home/john/Music for me) and gave it execute priviliges to me.
>
> The content of the file is: find . -not -name "*.flac" -print | cpio -pvdu /home/john/converted/ flac2mp3 ./ /home/john/converted/


John,

You can do this much better (IMHO) with rsync.

Try something like:

rsync -a --include=*.mp3 /home/john/Music/ /home/john/converted

> Obviously change /home/john/converted to the directory where you want
> all your mp3's and converted flacs to be placed. Also add the path to flac2mp3 (I have copied mine to /usr/bin/ therefore it doesnt need
> a path).
>
> If I work out how to use cron, I should be able to set it up to run each night.


Personally, I'd setup separate cron jobs for the mp3 sync and the flac
conversion.

Edit your crontab using:

# crontab -e

Add the following lines to the crontab to run the above rsync command
and flac2mp3:

0 2 * * * rsync -a --include=*.mp3 /home/john/Music /home/john/converted
0 2 * * * flac2mp3 --quiet /home/john/Music /home/john/converted

This starts both processes at 02:00 every day.

Make sure both rsync and flac2mp3 are in a directory that is in the PATH
of your cron environment (not necessarily the same as your shell
environment)

> I will also look into running lame with a lower nice value otherwise things could get very slow on my server if the convert job extends into the day time!


The easiet way to do this is to use nice in the crontab, e.g.:

0 2 * * * nice flac2mp3 --quiet /home/john/Music /home/john/converted

Again. make sure nice is in the path.

>
> Sorry, this is linux specific I think.


linux/unix

>> I've set up a bunch of mail lists relating to flac2mp3.
>>
>> Details are here:
>>
>> http://robinbowes.com/article.php/20050611002827903
>
>
> crossposted to the the above mailing list, but figured more people would read it here.


I've also posted this reply there.

R.
--
http://robinbowes.com

If a man speaks in a forest,
and his wife's not there,
is he still wrong?

gorstk
2005-06-20, 05:58
robinbowes wrote:

> John,
>
> You can do this much better (IMHO) with rsync.
>
> Try something like:
>
> rsync -a --include=*.mp3 /home/john/Music/ /home/john/converted

This is probably the way to go /if/ I wanted to copy accross to my
windows machine, but at present I do not. I just want media player to be
able to access the converted folder over the network.

to save on disc space (and time) I have used to cpio -l option so that
instead of copying the mp3 files it uses links instead.

The problem I forsee with rsync is that it will copy any horrible
changes that media player makes to my files. With the above solution I
have media player access my files through a read only share to make sure
the linked files are 'safe'!!

Thanks for the help on the cron jobs will try soon.

gorstk
2005-06-20, 12:01
robinbowes wrote:

> John,
>
> You can do this much better (IMHO) with rsync.
>
> Try something like:
>
> rsync -a --include=*.mp3 /home/john/Music/ /home/john/converted

Actually I completely agree now!
The above works a lot better than my way with cron.

The only problem (which is already a known bug) is that flac2mp3 throws
the toys out of the cot if it comes accross odd file names with odd
characters in in especially I'm and don't. Will take a look tomorow

>
>>Obviously change /home/john/converted to the directory where you
>
> want
>
>> all your mp3's and converted flacs to be placed. Also add the path
>
> to flac2mp3 (I have copied mine to /usr/bin/ therefore it doesnt need
>
>> a path).
>>
>>If I work out how to use cron, I should be able to set it up to run
>
> each night.
>
>
> Personally, I'd setup separate cron jobs for the mp3 sync and the flac
> conversion.
>
> Edit your crontab using:
>
> # crontab -e
>
> Add the following lines to the crontab to run the above rsync command
> and flac2mp3:
>
> 0 2 * * * rsync -a --include=*.mp3 /home/john/Music
> /home/john/converted
> 0 2 * * * flac2mp3 --quiet /home/john/Music /home/john/converted
>
> This starts both processes at 02:00 every day.
>
> Make sure both rsync and flac2mp3 are in a directory that is in the
> PATH
> of your cron environment (not necessarily the same as your shell
> environment)
>
>
>>I will also look into running lame with a lower nice value otherwise
>
> things could get very slow on my server if the convert job extends into
> the day time!
>
>
> The easiet way to do this is to use nice in the crontab, e.g.:
>
> 0 2 * * * nice flac2mp3 --quiet /home/john/Music /home/john/converted
>
> Again. make sure nice is in the path.
>
>
>>Sorry, this is linux specific I think.
>
>
>
> linux/unix
>
>
>>>I've set up a bunch of mail lists relating to flac2mp3.
>>>
>>>Details are here:
>>>
>>>http://robinbowes.com/article.php/20050611002827903
>>
>>
>>crossposted to the the above mailing list, but figured more people
>
> would read it here.
>
>
> I've also posted this reply there.
>
> R.

Robin Bowes
2005-06-20, 14:22
John Gorst wrote:
> robinbowes wrote:
>
>> John,
>>
>> You can do this much better (IMHO) with rsync.
>>
>> Try something like:
>>
>> rsync -a --include=*.mp3 /home/john/Music/ /home/john/converted
>
>
> Actually I completely agree now!
> The above works a lot better than my way with cron.

Glad it's working for you,

> The only problem (which is already a known bug) is that flac2mp3 throws
> the toys out of the cot if it comes accross odd file names with odd
> characters in in especially I'm and don't. Will take a look tomorow

Hmmm. I wasn't aware of this. I just tried renaming one of my test files
to "I'm A Bad.flac" and it converted it OK.

What symptoms are you seeing?

R.
--
http://robinbowes.com

max.spicer
2005-06-20, 15:17
Aha! I too have a utility named flac2mp3.pl which, surprisingly enough,
converts flac files to mp3 format.
Ah, well reminded. I tried using your script about a month ago but it failed due to the way you quote single quotes. I seem to recall you seem to escape too many characters ('"* etc etc), and the escaping of single quotes causes lame to fail. Is this a known/fixed issue? I got as far as nearly fixing it myself (in which case I'd have emailed the fix to you), but then my wife decided that the 60 albums that her Karma will fit in flac format was enough to be going on with anyway!

Please don't in any way read this post as a complaint, by the way! Your script does nearly exactly what I was looking for so the work you've put into writing it is more than appreciated.

max.spicer
2005-06-20, 15:28
Whoops, turns out it was lossylibrarysync.pl (http://seatofthepants.net/?_d=_s2) that I used before! This is another script to go from flac to mp3 and also handles updates to tags without having to reencode the mp3s. It did have the problems I mentioned, but I notice there have been new versions since.

Max

PS But I still appreciate your effort in writing flac2mp3.pl and making it available, Robin. ;-) I'll give it a go when I have a chance.

Ah, well reminded. I tried using your script about a month ago but it failed due to the way you quote single quotes. I seem to recall you seem to escape too many characters ('"* etc etc), and the escaping of single quotes causes lame to fail. Is this a known/fixed issue? I got as far as nearly fixing it myself (in which case I'd have emailed the fix to you), but then my wife decided that the 60 albums that her Karma will fit in flac format was enough to be going on with anyway!

Please don't in any way read this post as a complaint, by the way! Your script does nearly exactly what I was looking for so the work you've put into writing it is more than appreciated.

Robin Bowes
2005-06-20, 15:33
max.spicer wrote:
> Robin Bowes Wrote:
>
>>Aha! I too have a utility named flac2mp3.pl which, surprisingly enough,
>>
>>converts flac files to mp3 format.
>
> Ah, well reminded. I tried using your script about a month ago but it
> failed due to the way you quote single quotes. I seem to recall you
> seem to escape too many characters ('"* etc etc), and the escaping of
> single quotes causes lame to fail. Is this a known/fixed issue?

Well, John has also reported a similar problem, but I've not seen it myself.

Can you give me an example?

> I got
> as far as nearly fixing it myself (in which case I'd have emailed the
> fix to you), but then my wife decided that the 60 albums that her Karma
> will fit in flac format was enough to be going on with anyway!

Heh.

> Please don't in any way read this post as a complaint, by the way!
> Your script does nearly exactly what I was looking for so the work
> you've put into writing it is more than appreciated.

Don't worry - I'm much more thick-skinned than that! I wrote flac2mp3
for myself and if it happens to be useful for others, that's a bonus.

R.
--
http://robinbowes.com

gorstk
2005-06-21, 00:10
Robin Bowes wrote:

>> The only problem (which is already a known bug) is that flac2mp3
>> throws the toys out of the cot if it comes accross odd file names with
>> odd characters in in especially I'm and don't. Will take a look tomorow
>
>
> Hmmm. I wasn't aware of this. I just tried renaming one of my test files
> to "I'm A Bad.flac" and it converted it OK.
>
> What symptoms are you seeing?

/usr/bin/flac --decode --stdout --silent
"/home/john/Music/Albumsflac/Fleetwood Mac/Rumours/04 - Don't Stop -
Rumours - Fleetwood Mac.flac"| /usr/bin/lame --preset medium
--replaygain-accurate --quiet -
"/home/john/convertedtest/Albumsflac/Fleetwood Mac/Rumours/04 - Don't
Stop - Rumours - Fleetwood Mac.mp3" failed with exit code 36096

Processing "15 - Don't need the sun to shine (to make me smile) - Dreams
can come true - Gabrielle.flac"

So sometimes it works some times it doesn't. Is there more than one type
of ' ? When I was trying to get easytag to rename all my flacsto get rid
of ' it would not work if I just pressed ' on my keyboard, I had to copy
and paste the character from the filename itself.

Thanks

gorstk
2005-06-21, 01:44
John Gorst wrote:
> Robin Bowes wrote:
>
>>> The only problem (which is already a known bug) is that flac2mp3
>>> throws the toys out of the cot if it comes accross odd file names
>>> with odd characters in in especially I'm and don't. Will take a look
>>> tomorow
>>
>>
>>
>> Hmmm. I wasn't aware of this. I just tried renaming one of my test
>> files to "I'm A Bad.flac" and it converted it OK.
>>
>> What symptoms are you seeing?
>
>
> /usr/bin/flac --decode --stdout --silent
> "/home/john/Music/Albumsflac/Fleetwood Mac/Rumours/04 - Don't Stop -
> Rumours - Fleetwood Mac.flac"| /usr/bin/lame --preset medium
> --replaygain-accurate --quiet -
> "/home/john/convertedtest/Albumsflac/Fleetwood Mac/Rumours/04 - Don't
> Stop - Rumours - Fleetwood Mac.mp3" failed with exit code 36096
>
> Processing "15 - Don't need the sun to shine (to make me smile) - Dreams
> can come true - Gabrielle.flac"
>
> So sometimes it works some times it doesn't. Is there more than one type
> of ' ? When I was trying to get easytag to rename all my flacsto get rid
> of ' it would not work if I just pressed ' on my keyboard, I had to copy
> and paste the character from the filename itself.

I have figured it out. It works ok with ' but does not work with `. Look
at ' vs ` I cant work out how to get that character on my keyboard, I
just copied it from the tag information which was generated by EAC.

HTH

gorstk
2005-06-21, 05:06
Robin Bowes wrote:

>> The only problem (which is already a known bug) is that flac2mp3
>> throws the toys out of the cot if it comes accross odd file names with
>> odd characters in in especially I'm and don't. Will take a look tomorow
>
>
> Hmmm. I wasn't aware of this. I just tried renaming one of my test files
> to "I'm A Bad.flac" and it converted it OK.
>
> What symptoms are you seeing?

After about 5 hours hard work the script just stumbled on the following:

Processing "17 - Suicide Is Painless (Theme From MASH) - Forever Delayed
(The Greatest Hits) (DISC 1) - Manic Street Preachers.flac"
/usr/bin/flac --decode --stdout --silent
"/home/john/Music/Albumsflac/Manic Street Preachers/Forever Delayed (The
Greatest Hits) (DISC 1)/17 - Suicide Is Painless (Theme From MASH) -
Forever Delayed (The Greatest Hits) (DISC 1) - Manic Street
Preachers.flac"| /usr/bin/lame --preset medium --replaygain-accurate
--quiet - "/home/john/converted/Albumsflac/Manic Street
Preachers/Forever Delayed (The Greatest Hits) (DISC 1)/17 - Suicide Is
Painless (Theme From MASH) - Forever Delayed (The Greatest Hits) (DISC
1) - Manic Street Preachers.mp3" failed with exit code 36096

But then when I ran the script again it all worked fine... odd

m1abrams
2005-06-21, 07:44
Wow imagine that I wrote my own perl script for doing this too and named it flac2mp3.pl also ;)

Mine also uses a module I wrote (with stuff parsed from others code) but have not published called GetFlacTag , wrote this awhile ago when I could not find any perl modules to get the FLAC metadata. I imagine there are better modules out there for this but mine seems to work with all my music.

The one issue I have had is lame has issues with certain characters when taggin data. Also the genre's because it is tagging v1 are very limited.

Anyhow, here is my code. Note my script requires lame encoder and flac decoder. run flac2mp3.pl -h to see the command line options.

edit: for some reason .pl and .pm files not allowed so I added .txt to them. Please remove that before using.

gorstk
2005-06-21, 08:03
m1abrams wrote:
> Wow imagine that I wrote my own perl script for doing this too and named
> it flac2mp3.pl also ;)

It seems perl coders are all very like minded!

I think I may have to start reading a bit on perl coding.

robinbowes
2005-06-21, 08:38
Robin Bowes wrote:

>> The only problem (which is already a known bug) is that flac2mp3
>> throws the toys out of the cot if it comes accross odd file names with
>> odd characters in in especially I'm and don't. Will take a look tomorow
>
>
> Hmmm. I wasn't aware of this. I just tried renaming one of my test files
> to "I'm A Bad.flac" and it converted it OK.
>
> What symptoms are you seeing?

After about 5 hours hard work the script just stumbled on the following:

Processing "17 - Suicide Is Painless (Theme From MASH) - Forever Delayed
(The Greatest Hits) (DISC 1) - Manic Street Preachers.flac"
/usr/bin/flac --decode --stdout --silent
"/home/john/Music/Albumsflac/Manic Street Preachers/Forever Delayed (The
Greatest Hits) (DISC 1)/17 - Suicide Is Painless (Theme From MASH) -
Forever Delayed (The Greatest Hits) (DISC 1) - Manic Street
Preachers.flac"| /usr/bin/lame --preset medium --replaygain-accurate
--quiet - "/home/john/converted/Albumsflac/Manic Street
Preachers/Forever Delayed (The Greatest Hits) (DISC 1)/17 - Suicide Is
Painless (Theme From MASH) - Forever Delayed (The Greatest Hits) (DISC
1) - Manic Street Preachers.mp3" failed with exit code 36096

But then when I ran the script again it all worked fine... odd

Hmmm. Odd indeed.

If you can find a definite re-producible example then I can look into it. As I said, I'm not seeing any problems like this at all so it's kinda hard to debug!

If you do find an example, can you make the flac file available to me?

Thanks,

R.

gorstk
2005-06-21, 08:50
robinbowes wrote:

> Hmmm. Odd indeed.
>
> If you can find a definite re-producible example then I can look into
> it. As I said, I'm not seeing any problems like this at all so it's
> kinda hard to debug!
>
> If you do find an example, can you make the flac file available to me?

did you try renaming a file with a ' in to ` (just copy and paste it).
That seems to break it on my system.

Cheers

Robin Bowes
2005-06-21, 11:31
John Gorst wrote:
>
> did you try renaming a file with a ' in to ` (just copy and paste it).
> That seems to break it on my system.

John,

I just tagged a file with a comment file of three backticks (```) and it
converted fine for me.

Like I said, if you can send me a file that has this problem so I can
reproduce the issue I'll look into it further.

Incidentally, what version of the script are you running?

R.

PS. Can I suggest taking this over to the
flac2mp3-general (AT) robinbowes (DOT) com list?
--
http://robinbowes.com

Neil Sleightholm
2005-06-21, 14:11
Robin, sorry to jump in here but I have just tried your script (Version 0.2.3) on Windows and I get this error "Couldn't write tag! at C:/Perl/site/lib/MP3/TAG/ID3v2.pm line 350.". Do you any ideas what would cause this?

I should say I needed to make 2 changes to make it work on Windows:
1. Changed: #our $flaccmd = "/usr/bin/flac"; and #our $lamecmd = "/usr/bin/lame";
To: our $flaccmd = "flac.exe"; and our $lamecmd = "lame.exe";
2. Changed $mp3->new_tag("ID3v2"); to $mp3->newTag("ID3v2");

Neil

Robin Bowes
2005-06-21, 15:09
Neil Sleightholm wrote:
> Robin, sorry to jump in here but I have just tried your script (Version
> 0.2.3) on Windows and I get this error "Couldn't write tag! at
> C:/Perl/site/lib/MP3/TAG/ID3v2.pm line 350.". Do you any ideas what
> would cause this?

Which version of MP3::Tag are you using? In my version, line 350 is in
the middle of pod section.

> I should say I needed to make 2 changes to make it work on Windows:
> 1. Changed: #our $flaccmd = "/usr/bin/flac"; and #our $lamecmd =
> "/usr/bin/lame";
> To: our $flaccmd = "flac.exe"; and our $lamecmd = "lame.exe";

Yep, as I would expect.

> 2. Changed $mp3->new_tag("ID3v2"); to $mp3->newTag("ID3v2");

You're definitely using an older version of MP3::Tag.

From the CPAN page:

new_tag()

[old name: newTag() . The old name is still available, but its use is
not advised]

Can I suggest we take this thread off the slimdevices forum/list and
over to my list for flac2mp3 as detailed here:

http://robinbowes.com/article.php/20050611002827903

R.
--
http://robinbowes.com

Neil Sleightholm
2005-06-22, 14:40
It was a very old version of MP3::Tag.

Neil

JustaBum
2005-07-17, 08:57
For those reading this thread and their eyes are blurry from seeing all the /home/ /// do a back flip / slash/ crontab/ cromagnum/ blah blah....

I use a simple windows based program to convert my flacs to mp3.

http://www.dbpoweramp.com/dmc.htm

Though it's 'free' for most things, the mp3 encoding is in the power pack. But, for $14, it is well well worth it.

A big benefit is the File select feature. I can pull up my whole music directory, and choose what formats (SHN, FLAC, WAV etc) I want to convert into what format. Can control the output, etc. Delete or not after conversion... blah blah blah.

Not knocking the flac2mp3 program. Just offering another option for those who don't know what a / is. :)

Brian

Aylwin
2005-07-17, 10:14
Actually, I haven't got around to trying this Perl stuff yet. I've been using Media Monkey in the past and it turns out the lastest version supports FLAC. So now I can easily convert from FLAC to MP3. Plus, it's free!

Robin Bowes
2005-07-22, 09:54
JustaBum wrote:

> Not knocking the flac2mp3 program. Just offering another option for
> those who don't know what a / is. :)

Brian,

You're right - flac2mp3 is not for everybody. You need to be at least
comfortable with running perl scripts at the command line to use it.

I wrote it not because there are no flac->mp3 convertors out there, but
because I wanted something that could keep a directory full of flac
files syncronised with a directory full of converted mp3 files without
having to re-convert all the flacs everytime I run the conversion.

When I add new files to my flac library, I run flac2mp3 on the whole
library and it can detect the new files and convert them. It also
detects if I've just changed any tags in the flac files and can re-write
the mp3 tags without running the whole flac->mp3 conversion process.

As I've got around ??? flac files, this represents a considerable
time-saving for me!

Having said that, if I can I find a free/commercial GUI-driven tool that
has this functionality I'll use it!

BTW, I'm about to release a new version of flac2mp3 that adds a couple
of tagging fixes. I must get round to packaging it up and doing a release.

R.

max.spicer
2005-07-22, 10:55
I shall look forward to that - I'm going to finally get around to converting all my flacs to mp3 very soon (honest!). Let us know on the forums when it's out and I'll be a tester for you. I'm in a learning Perl mode atm (as I'm determined to start hacking SlimServer), so I should be able to help fix any bugs I find as well.

Thanks,

Max



BTW, I'm about to release a new version of flac2mp3 that adds a couple
of tagging fixes. I must get round to packaging it up and doing a release.

DWallach
2005-07-25, 17:21
I'm about to rerip my entire collection (~1200 CDs) once and for good, and I've decided to go with one of the lossless formats. Right now, I've got everything in MP3 format, stored in iTunes. In too many cases, I've put a whole lot of effort into cleaning up the tags, adding BPMs, star ratings, and so forth. Starting over from scratch is something I want to avoid at all costs.

I've got a SqueezeBox, a 2nd-gen iPod, and a Rio Car Player. My tunes live on a Mac, soon to be augmented with an Infrant NAS box, which will be the primary server for the SqueezeBox.

Given my situation, particularly with all the metadata stored in iTunes, I'm unclear whether I want to do Apple Lossless, which is nicely integrated with iTunes, or whether I want to do FLAC, where there are nice automated tools (described in this thread) to convert things. Furthermore, I need some way of systematically matching up albums that I ripped earlier and applying the metadata to the new files. I'm curious if anybody is aware of anything already out there that can do the job. If I was going to write it myself, I see that there are Perl libraries that understand MP3/ID3 tags and FLAC tags, but what about M4A/ALAC tags? According to CPAN, the MP4::Info module supports reading but not writing these tags. Somehow, I can see myself writing a tool that outputs an AppleScript to run through iTunes. Please tell me there's a better way.

phil_saunders
2005-12-30, 06:40
I have sympathy with anyone trying to convert FLAC audio files to MP3 - especially if they want to use the LAME MP3 encoder using their own settings and don't want to pay for the privilage.

Luckily I (eventually) found a solution in the form of a nice piece of free software called "Frontah".

I've written a short article explaining more. You can find it at:
http://www.philsaunders.com/convert_flac_to_mp3/

bobharp
2005-12-30, 11:28
Thanks for the artilce phil.

I have been looking for the magic transcoder for some time now and hope to test MediaCoder soon(http://www.rarewares.org/mediacoder) and (http://sourceforge.net/projects/mediacoder/).

I was also looking at Jinzora (http://www.jinzora.org/index.php).

ezkcdude
2005-12-30, 13:18
I'm about to rerip my entire collection (~1200 CDs) once and for good, and I've decided to go with one of the lossless formats. Right now, I've got everything in MP3 format, stored in iTunes. In too many cases, I've put a whole lot of effort into cleaning up the tags, adding BPMs, star ratings, and so forth. Starting over from scratch is something I want to avoid at all costs.

I've got a SqueezeBox, a 2nd-gen iPod, and a Rio Car Player. My tunes live on a Mac, soon to be augmented with an Infrant NAS box, which will be the primary server for the SqueezeBox.

Given my situation, particularly with all the metadata stored in iTunes, I'm unclear whether I want to do Apple Lossless, which is nicely integrated with iTunes, or whether I want to do FLAC, where there are nice automated tools (described in this thread) to convert things. Furthermore, I need some way of systematically matching up albums that I ripped earlier and applying the metadata to the new files. I'm curious if anybody is aware of anything already out there that can do the job. If I was going to write it myself, I see that there are Perl libraries that understand MP3/ID3 tags and FLAC tags, but what about M4A/ALAC tags? According to CPAN, the MP4::Info module supports reading but not writing these tags. Somehow, I can see myself writing a tool that outputs an AppleScript to run through iTunes. Please tell me there's a better way.

I am going to eventually re-rip everything into FLAC, too. I've given up on iTunes. I just use SlimServer to play everything. While you're ripping make high quality mp3's at the same time, so you can easily import those into iTunes. You can use iTunes-LAME for that.

As for Jinzora, it looks cool, but you have to set up an Apache/PHP server, which is a royal pain in the ass, if you're not a sysadmin.

jarome
2006-01-02, 09:45
http://forums.winamp.com/showthread.php?threadid=225551&highlight=flac+to+mp3+convert
You will need the FLAC and transcoder plugins

Mark Lanctot
2006-01-10, 09:58
foobar2000 can also do this.

Took me a while to get it working: http://forums.slimdevices.com/showpost.php?p=77046&postcount=5

joncourage
2006-01-10, 11:47
For those re-ripping, consider using EAC with MAREO. MAREO lets you rip to multiple formats simultaneously. Takes a bit of setting up, not great documentation, but once it's working it does the job nicely, using the native encoding engines of course, so all configurable settings are available.

Mark Lanctot
2006-01-10, 17:05
joncourage:

Thanks so much for the MAREO suggestion!

It looked dense at first but it didn't take long to configure the FLAC and MP3 encoders at all, since I had the settings from EAC already.

What did take long was configuring MP3Gain as a post-processor, but I worked through that as well.

So EAC with MAREO is now set to:

- rip to FLAC

- rip to MP3

- apply MP3Gain

all in one step! Thanks so much!

bernt
2006-01-11, 07:09
The GodFather can very easy convert from flac to mp3.

ianjohnson_nz
2006-03-16, 15:28
Pat Farrell wrote:[color=blue]
Aha! I too have a utility named flac2mp3.pl which, surprisingly enough,
converts flac files to mp3 format.

I wrote it for exactly the same situation - I store all my music in flac
format and needed to convert it to mp3 for my iPod.

My goal was to write something that I could just point at a directory
tree full of flac files and have it mirrored into a corresponding
directory structure full of mp3 files. I also only want to convert those
files that need converting, i.e. newly-added files. Finally, I didn't
want to have to re-transcode a file if only the tags have changed, so I
added a tags-only mode.

One of these days I'll get round to writing some documentation, but at
least it's got usage instructions now:

# flac2mp3
Usage: flac2mp3 [--quiet] [--debug] [--tagsonly] [--force] <flacdir>
<mp3dir>
--quiet Disable informational output to stdout
--debug Enable debugging output. For developers only!
--tagsonly Don't do any transcoding - just update tags
--force Force transcoding and tag update even if not required

To use the script, you'll need the following:

flac
lame
Perl
Perl modules:
- Audio::FLAC::Header
- MP3::Tag

Caveat: I've only tested it on Linux (Fedora Core 3), but it should work
OK on Windows if you can get Audio::FLAC::Header installed.

flac2mp3 is currently available here:

http://robinbowes.com/filemgmt/viewcat.php?cid=4

Thanks very much for this Robin, I just downloaded it and as a newbie to Perl worked out how to run it. Fantastic little utility.

One question: what LAME setting does it use for the MP3 files? Can these be adjusted?

Many thanks again for such a convenient little util.

Regards, Ian

Robin Bowes
2006-03-16, 15:38
ianjohnson_nz wrote:
>
> Thanks very much for this Robin, I just downloaded it and as a newbie
> to Perl worked out how to run it. Fantastic little utility.

Glad you found it useful.

>
> One question: what LAME setting does it use for the MP3 files? Can
> these be adjusted?

Sure.

Look for these lines in flac2mp3.pl:

# Modify lame options if required
our @lameargs = qw (
--preset standard
--quiet
);

Simply add whatever lame switches you require between the brackets.

>
> Many thanks again for such a convenient little util.

np.

R.

Rene
2006-03-17, 05:04
I am curently using a modified version of Robin's flac2mp3.pl
that allows me to also copy the MusicIP (aka MusicMagic) fingerprint and analysis data into mp3 tags.
For me it is the most efficient way to keep my large FLAC archive in sync with the trancoded MP3 archive.
To speed up thigs, I ran multiple instances of flac2mp3.pl on 2 Linux systems (using SuSE V10)in the background.
Keeping the tags in sync with the master FLAC archive without transcoding is also very very helpfull to maintain large archives.
Being a comand line tool, automation is easy to do a already pointed out.
regards
Rene

Robin Bowes
2006-03-17, 05:13
Rene wrote:
> I am curently using a modified version of Robin's flac2mp3.pl
> that allows me to also copy the MusicIP (aka MusicMagic) fingerprint
> and analysis data into mp3 tags.
> For me it is the most efficient way to keep my large FLAC archive in
> sync with the trancoded MP3 archive.
> To speed up thigs, I ran multiple instances of flac2mp3.pl on 2 Linux
> systems (using SuSE V10)in the background.
> Keeping the tags in sync with the master FLAC archive without
> transcoding is also very very helpfull to maintain large archives.
> Being a comand line tool, automation is easy to do a already pointed
> out.

Rene,

Presumably, you've simply extended the %MP3Frames hash?

Can you create a new ticket to:

http://robinbowes.com/projects/flac2mp3

and attach a patch? I'll include in the next version.

R.

Rene
2006-03-17, 06:31
Yes, and editing the fingerprint and analyis tag, as the string is slightly different in MP3.
I also used newer version of the MP3 and FLAC modules from CPAN.
I will send the code, so you can incorparate it.
regards
Rene

jimmy
2007-01-06, 07:12
All

I have installed flac2mp3 from robinbowes.com (thanks Robin for flac2mp3 - it will be *very* useful to me). Am struggling to get it working at the moment though. I have flac.exe and lame.exe installed at C:\codecs so I changed the flac2mp3.pl script to read as follows:

# ------- User-config options start here --------
# Assume flac and lame programs are in the path.
# If not, put full path to programs here.
our $flaccmd = "c:\\codecs\\flac.exe";
our $lamecmd = "c:\\codecs\\lame.exe";

but when I run I get:
c:\codecs\flac.exe not found at c:\Program Files\flac2mp3\flac2mp3.pl line 144

I'd be very grateful if someone could help me out.

Thanks
Jimmy

Robin Bowes
2007-01-06, 08:04
jimmy wrote:
> All
>
> I have installed flac2mp3 from robinbowes.com (thanks Robin for
> flac2mp3 - it will be *very* useful to me). Am struggling to get it
> working at the moment though. I have flac.exe and lame.exe installed at
> C:\codecs so I changed the flac2mp3.pl script to read as follows:
>
> # ------- User-config options start here --------
> # Assume flac and lame programs are in the path.
> # If not, put full path to programs here.
> our $flaccmd = "c:\\codecs\\flac.exe";
> our $lamecmd = "c:\\codecs\\lame.exe";
>
> but when I run I get:
> c:\codecs\flac.exe not found at c:\Program Files\flac2mp3\flac2mp3.pl
> line 144

Does it work if you run "c:\codecs\flac.exe" from the command line?

Also, I would recommend not using v0.2.9 at the moment, there are
problems with how the flac/lame commands are executed, especially on
Windows. You should OK with 0.2.7

R.

jimmy
2007-01-06, 09:43
Does it work if you run "c:\codecs\flac.exe" from the command line?

Also, I would recommend not using v0.2.9 at the moment, there are
problems with how the flac/lame commands are executed, especially on
Windows. You should OK with 0.2.7

R.

Robin. It was version 0.2.9 that was causing the problem. 0.2.7 works fine. Many thanks.

ncfoster
2007-01-31, 16:21
Hello,

First off, thanks to Robin for this script. It is saving me a lot of time. However, I am having problems just letting it run. I am running version 0.2.9, BTW. After some period of time running the script, I will always get the following error:

fork() failed: Resource temporarily unavailable at D:\Perl\flac2mp3\flac2mp3.pl line 585.

The script then terminates, and I have to restart it whenever I next come back to the computer and notice it. Obviously, this slows things down a fair amount. I read something about registry edits that might help with the "resource" problem, but the changes I made didn't seem to do anything.

I have a two part question. First, is there any way that the script might be easily modified in such a way that it would periodically flush out whatever "resources" might be getting taxed (or maybe the error means something else)? Second, if that would be too difficult, is there an easy way in perl that the script could check for this error condition, and then just re-start the script automatically? If nobody knows, this might be my excuse to learn perl.

On a related note, the script also gives me several instances of this error:

'mv' is not recognized as an internal or external command, operable program or batch file.

These errors seem to be mostly harmless, as the script proceeds. However, I believe that when these errors occur, the generated files have problems with their ID3 tags (after running this script, I always have some files with missing tags). This issue is not as critical, as the script doesn't stop. Obviously, however, I'd love to be able to fix this, too.

Also, I should note that I had problems with the path issues as well, and I tried putting in the paths in various ways. I finally just put all of the important stuff in the default windows paths, which made life a lot easier.

Thanks in advance.

Nathan

Robin Bowes
2007-01-31, 17:24
ncfoster wrote:
> Hello,
>
> Firstm thanks to Robin for this script. It is saving me a lot of time.
> However, I am having problems just letting it run. I am running version
> 0.2.9, BTW. After some period of time running the script, I will always
> get the following error:
>
> fork() failed: Resource temporarily unavailable at
> D:\Perl\flac2mp3\flac2mp3.pl line 585.
>
> The script then terminates, and I have to restart it whenever I next
> come back to the computer and notice it. Obviously, this slows things
> down a fair amount. I read something about registry edits that might
> help with the "resource" problem, but the changes I made didn't seem to
> do anything.
>
> I have a two part question. First, is there any way that the script
> might be easily modified in such a way that it would periodically flush
> out whatever "resources" might be getting taxed (or maybe the error
> means something else)? Second, if that would be too difficult, is
> there an easy way in perl that the script could check for this error
> condition, and then just re-start the script automatically? If nobody
> knows, this might be my excuse to learn perl.

Nathan,

I'm afraid the last couple of releases have not been good. I tried a
different way to launch flac and lame to do the conversion and it didn't
work out too well.

Until I find time to release 0.30, I suggest you grab the latest code
from svn and use that.

>
> On a related note, the script also gives me several instances of this
> error:
>
> 'mv' is not recognized as an internal or external command, operable
> program or batch file.
>

Hmmm. Later revisions are transcoding to a temp file and renaming it,
which will use "mv" on Linux/Unix but I had assumed it will use "move"
on Windows.

I'll check for compatibility before I release 0.30.

R.

gleam
2007-06-18, 20:24
I'm having a slight problem with flac2mp3. I've got classical music tagged with BAND or ORCHESTRA, and non-classical compilations tagged with ALBUMARTIST.

What it seems like is happening is flac2mp3 wants to retag every album that uses either BAND or ALBUMARTIST:



frame: 'BAND'
srcframe value: ''
destframe value: 'Aphex Twin'
Writing tags to "/music/mp3/Aphex Twin/26 Mixes for Cash (Disc 1)/01-Time To Find Me (AFX Fast Mix).mp3"




frame: 'ALBUMARTIST'
srcframe value: ''
destframe value: 'Berliner Philharmoniker'
Writing tags to "/music/mp3/Berliner Philharmoniker/Die Zauberflote (The Magic Flute) (Disc 3)/11-Second Act, Nr. 21. Finale: Die Strahlen der Sonne vertreiben die Nacht.mp3"


(n.b.: I'm running the latest flac2mp3.pl from subversion, and I've modified it to have both BAND and ALBUMARTIST map to TPE2)

Basically, I'm looking for a way for it to not get confused by having either BAND or ALBUMARTIST but not both.

It doesn't seem to have any problems actually tagging things properly... it just spends a lot more time than it seems like it should. It is physically touching the files every time I run flac2mp3, and there's really no reason for it to be.

Is there some easy logic I can add to have it not retag in this scenario? I care more about ALBUMARTIST than BAND, but I'd like to find a way for them to both be used.

Any advice is appreciated.

Edit to say: In the meantime, I've stopped trying to map BAND to TPE2, since my classical music has ARTIST=BAND anyway. But I'd like to fix it, anyway..

Also, I've noticed that it doesn't deal well with =s in metatags. This looks like a known problem. I'm curious what it takes to fix it. Currently it's tagging it with:
srcframe value: 'ARRAY(0x864a9fc)'
destframe value: 'ARRAY(0x86e1b88)'

Robin Bowes
2007-06-19, 01:02
gleam wrote:
> I'm having a slight problem with flac2mp3. I've got classical music
> tagged with BAND or ORCHESTRA, and non-classical compilations tagged
> with ALBUMARTIST.
>
> What it seems like is happening is flac2mp3 wants to retag every album
> that uses either BAND or ALBUMARTIST:
>
>> frame: 'BAND'
>> srcframe value: ''
>> destframe value: 'Aphex Twin'
>> Writing tags to "/music/mp3/Aphex Twin/26 Mixes for Cash (Disc
>> 1)/01-Time To Find Me (AFX Fast Mix).mp3"
>>
>
>> frame: 'ALBUMARTIST'
>> srcframe value: ''
>> destframe value: 'Berliner Philharmoniker'
>> Writing tags to "/music/mp3/Berliner Philharmoniker/Die Zauberflote
>> (The Magic Flute) (Disc 3)/11-Second Act, Nr. 21. Finale: Die Strahlen
>> der Sonne vertreiben die Nacht.mp3"
>>
>
> (n.b.: I'm running the latest flac2mp3.pl from subversion, and I've
> modified it to have both BAND and ALBUMARTIST map to TPE2)
>
> Basically, I'm looking for a way for it to not get confused by having
> either BAND or ALBUMARTIST but not both.
>
> It doesn't seem to have any problems actually tagging things
> properly... it just spends a lot more time than it seems like it
> should. It is physically touching the files every time I run flac2mp3,
> and there's really no reason for it to be.
>
> Is there some easy logic I can add to have it not retag in this
> scenario? I care more about ALBUMARTIST than BAND, but I'd like to
> find a way for them to both be used.
>
> Any advice is appreciated.

Hi,

Please create a ticket on the website
(http://robinbowes.com/projects/flac2mp3) and attach a few of the files
in question after truncating the audio using the script in this thread:
http://forums.slimdevices.com/showthread.php?t=17228

It's an issue I've hit myself but I've not looked into it in any great
detail.

R.

schiegl
2007-06-19, 12:15
Hi,

certainly not the most elegant way converting a FLAC library to mp3 but in the mind of open source at least another way. Just hacked this shell-script for my personal use/requirement so there's no warranty and i will not be responsible if this script erases your music library - certainly not designed to do it :-)

system/requirements
- GNU Linux
- flac/metaflac binaries
- lame binaries
- id3tag (http://id3lib.sourceforge.net/)

features (disclamer: on my system)
- duplicate a directory with all subfolders, at the same time converting all .flac files to .mp3 (non .flac files are just copied)
- works with all non usual file and directory names (umlauts, spaces, ', ..)
- exclude directories/files with glob patterns. I have some surround tracks (ac3, dts) with no use on the portable player
- preserve the most common tags (including values with special chars like german umlauts using the ISO8859-15 code-page; YMMV)
- use file timestamps to process only non-exisiting or new files, sync timestamps between both directories so another sync-tool could be used to transfer all new files to another device
- optional: remove mp3 files with no flac counterpart to keep both libraries in sync.

This script's called via daily cron and keeps my portable mp3 lib up to date. It should be most self explaning so if this is of any use to you - use/modify it to your own needs...

Markus

hirsp1
2008-08-08, 15:32
Windows Vista64

I'm getting the following:


C:\Program Files (x86)\flac2mp3>flac2mp3.pl Z:\Music\Music\FLAC Z:\Music\Music MP3
Can't locate Audio/FLAC/Header.pm in @INC (@INC contains: C:/Program Files (x86)/flac2mp3/lib C:/Perl64/site/lib C:/Perl64/lib .) at C:\Program Files (x86)\flac2mp3\flac2mp3.pl line 17.
BEGIN failed--compilation aborted at C:\Program Files (x86)\flac2mp3\flac2mp3.pl
line 17.

Line 17 is:

use Audio::FLAC::Header;

Any thoughts?

m1abrams
2008-08-08, 17:38
Yeah you need to install the Audio::Flac::Header perl module. This module is not part of the standard perl install.

Nonreality
2008-08-09, 01:17
Ummm maybe I'm missing something, but why not just use dbpoweramp. Or Foobar. Or mediamonkey. If it's because of an apple then I see the problem and sorry I didn't read the entire thread.

hirsp1
2008-08-09, 15:23
Thanks.

Now, if I could only find a 64 bit version that works on my Vista64....

radish
2008-08-09, 21:03
Ummm maybe I'm missing something, but why not just use dbpoweramp. Or Foobar. Or mediamonkey.

Because they're not scriptable, and they're not setup to do things like differential conversions (i.e. only convert what's new/changed). If I just had a bunch of flacs I wanted to convert I'd use dbp, but it's no good for keeping my mp3 shadow archive up to date as I change tags, add files, etc. Robin's script does that flawlessly.

Nonreality
2008-08-14, 03:21
Because they're not scriptable, and they're not setup to do things like differential conversions (i.e. only convert what's new/changed). If I just had a bunch of flacs I wanted to convert I'd use dbp, but it's no good for keeping my mp3 shadow archive up to date as I change tags, add files, etc. Robin's script does that flawlessly.Ok I understand I think. So you don't do it as you go. dbpoweramp has a command line but I've never used it. Couldn't that be scripted? I'm not enough of a script user to know but if you post what you want to do in their forum I'm sure Spoon or someone would have an answer. Then you could show me how. :)

spoon
2008-08-14, 12:51
If you are handy with VB scripting:

http://www.dbpoweramp.com/developer-scripting-dmc.htm

JJZolx
2008-08-14, 14:10
If you are handy with VB scripting:

http://www.dbpoweramp.com/developer-scripting-dmc.htm

If you're handy with VB scripting, then use it as a wrapper around Flac, Metaflac, LAME, taggers, and other software as needed. Gives you far more control than you could hope for from a conversion program.

radish
2008-08-14, 17:12
Ok I understand I think. So you don't do it as you go.
Yes, I do it as I go, but it's a management thing. Let's say I rip a couple of albums tonight into FLAC. I could load up dbP, find the albums I just ripped (assuming I remember which ones they were), hit convert and wait. Or I could just double-click the icon on my desktop which runs flac2mp3.pl and then leave it alone in the background - it figures out what needs to be done. Or lets say I notice a typo and fix it on a couple of FLAC files - again just a quick double click and the mp3s are updated to match. Or how about I'm playing with the endless Compilation and Album Artist permutations :) Change the FLACs, run the script, done. To me that's easier that pretty much anything else, and I know with 100% certainty that all my mp3 files are consistent.



dbpoweramp has a command line but I've never used it. Couldn't that be scripted?
I'm sure it could. But Robin kindly did all the work so I don't have to :) If dbp had a built in "sync this directory to this directory, converting/updating as needed" function then maybe I'd use it, but I don't want to write one myself when I already have it in perl.

spoon
2008-08-15, 02:41
You can do it all in about 6 clicks of the mouse:

Start Batch Converter, select the root FLAC folder >> Convert To
Click Convert and when it asks to overwrite select 'No to All'

radish
2008-08-15, 18:10
Does that update changed tags on the destination files if the audio hasn't changed? Anyway...if other people prefer a GUI more power to them, for things like this I prefer a script. I'm a programmer - there's no interface I understand better than source ;) All down to personal preference.

Nonreality
2008-08-15, 23:27
Does that update changed tags on the destination files if the audio hasn't changed? Anyway...if other people prefer a GUI more power to them, for things like this I prefer a script. I'm a programmer - there's no interface I understand better than source ;) All down to personal preference.Sorry Radish, like I said I'm not into scripts unless I can understand them, and that only happens once in a while anymore it seems:( . I was just trying to suggest an alternative. I'm more of a GUI type anymore, as I get older they seem to be easier to remember and dbpoweramp seems a bit of in between the two ideas.

spoon
2008-08-16, 02:50
Does that update changed tags on the destination files if the audio hasn't changed?

No it will not.

radish
2008-08-16, 10:51
Sorry Radish
Nothing to apologise for!



I was just trying to suggest an alternative. I'm more of a GUI type anymore, as I get older they seem to be easier to remember and dbpoweramp seems a bit of in between the two ideas.
Alternatives are great, it's what makes the SC/SB combo so powerful in my opinion, you're not locked into one way of doing things. I use (and love) dbPoweramp for ripping, and I do like how configurable and flexible it is. I'm a strong believer that you should use the tool that works best _for you_, whatever that might be. There's rarely a single choice which is best for everyone.

lstepnio
2008-09-06, 10:13
There seems to be bug in handling track numbers. I'm using flac2mp3-0.2.7


lstepnio@data:~/scripts/tmp$ ./flac2mp3.pl /mnt/storage/01/Music/FLAC /mnt/stora ge/01/Music/MP3
Processing directory: /mnt/storage/01/Music/FLAC
3466 flac files found. Sorting...done.
Argument "1/19" isn't numeric in multiplication (*) at ./flac2mp3.pl line 226.
Processing "A Tribe Called Quest/Anthology/A Tribe Called Quest - Anthology - 01 - Check the Rhime.flac"
Argument "2/19" isn't numeric in multiplication (*) at ./flac2mp3.pl line 226.
Processing "A Tribe Called Quest/Anthology/A Tribe Called Quest - Anthology - 02 - Bonita Applebum.flac"
Argument "3/19" isn't numeric in multiplication (*) at ./flac2mp3.pl line 226.
Processing "A Tribe Called Quest/Anthology/A Tribe Called Quest - Anthology - 03 - Award Tour.flac"
Argument "4/19" isn't numeric in multiplication (*) at ./flac2mp3.pl line 226.
Processing "A Tribe Called Quest/Anthology/A Tribe Called Quest - Anthology - 04 - Can I Kick It¿.flac"
Argument "5/19" isn't numeric in multiplication (*) at ./flac2mp3.pl line 226.
Processing "A Tribe Called Quest/Anthology/A Tribe Called Quest - Anthology - 05 - Scenario.flac"
Argument "6/19" isn't numeric in multiplication (*) at ./flac2mp3.pl line 226.
Processing "A Tribe Called Quest/Anthology/A Tribe Called Quest - Anthology - 06 - Buggin' Out.flac"

gnypp45
2008-09-06, 11:39
I don't know exactly what is caused your problem but the code for handling tracknumbers looks different in the latest release v0.3.0rc1 (http://projects.robinbowes.com/download/flac2mp3/). You might have better luck if you update to this version.

mikeruss
2009-03-05, 12:11
Works perfectly great stuff. My server is 100% as we speak. I won't need the heating on for a day or two.

Anyway thought I'd post this:

Fedora does not have mp3 apps such as lame in the standard yum repositories.

As we need lame for falc2mp3 we need an easy way to install. So if you run the following:

su -c "rpm -Uvh http://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-stable.noarch.rpm"
su -c "rpm -Uvh http://download1.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-stable.noarch.rpm"
su -c "yum install lame"

All done. Not only easier to install, but when there is a lame update Yum will deal with it.

agillis
2009-03-10, 20:25
VortexBox will autorip to both FLAC and mp3 at the same time. VortexBox also has a small script the will mirror your FLAC collection as mp3. Just run the script once and it will mirror your entire collection including downloading the cover art.

bephillips
2009-05-06, 16:39
I'd like to get flac2mp3 working on my collection. Trouble is I know very little about Perl, unix etc. I'm comfortable with doing things in the command line when I need to if given very explicit instructions. Is there somewhere where there are step by step instructions for Mac OS X? Specific questions:

Do I need to install Perl? Or is this already installed if I'm running SqueezeCenter? I'm looking at the system info shown in my sig below. Looks like I have this?

In what directory do I need to put the flac2mp3 archive (v0.3.0rc1)? Would that be /opt/local/bin? This archive has everything that flac2mp3 needs to run?

I understand there are GUI solutions for people like me. I've heretofore used Foobar on another machine for much of my transcoding, but the machine running SC isn't Intel, so I use Foobar over the LAN which is two slow for a massive transcoding operation like this. flac2mp3 also seems like the most elegant solution to the problem of ongoing maintainance.

Thanks in advance for any help and for your patience with my ignorance of these matters.

agillis
2009-05-06, 20:51
To run this on OSX you will need perl.

bephillips
2009-05-06, 20:58
Right. Got that. So look at my sig where it says "Perl Version: 5.8.8 - darwin-thread-multi-2level". Does this not mean that I must have Perl already installed if Squeezecenter reports this?

MrC
2009-05-06, 21:34
Yes, your Mac OS comes with perl already installed.

First, you'll need the "lame" and "flac" binaries - do you know if you have them installed?

bephillips
2009-05-06, 22:24
That was part of the problem, I had neglected to reinstall LAME and FLAC after a system clean install a while back. Then I was having problems invoking flac2mp3.pl because I'm unix stupid. But then I remembered that in the OS X Terminal window you can drag icons from the finder to get the paths, so:

Drag flac2mp3.pl from wherever it is into Terminal window -space-
Drag folder containing flacs to be transcoded into Terminal window -space-
Drag destination folder for mp3 files into Terminal window -return-

Working!

Thanks a lot to Robin Bowes for the great work on this. This is going to make changing stuff out on the iPods and iPhone much easier. I'll just have to set this to transcode the whole collection when I go out of town for a week soon. Looks like it'll take a very long time on my old G4 iBook.

bephillips
2009-05-06, 23:13
I see in flac2mp3.pl

"--preset standard"

If I understand correctly the lame wiki there are some finer settings between "standard" and "insane".
http://wiki.hydrogenaudio.org/index.php?title=LAME

Preset standard seemed to output 190kbps VBR files. What should be in this line if I want higher quality? Say if I want to use these finer -V switches instead of presets? Would this line then just be for 240 VBR:
"-V0"

The installer I found installed Lame 3.97. I read in the wiki this:

"The switch --vbr-new, which enabled a superior VBR mode in LAME 3.97 and some previous versions, is no longer needed with LAME 3.98 as it is now the default VBR mode. However, if you're still using LAME 3.97 or older, you have to add --vbr-new to your commandline to use that mode."

So should I also add this line if I'm using 3.97?

And what is the --quiet setting?

Thanks again for the help.

chrisinparis
2009-05-09, 08:42
Minor digression, but what's the best source for precompiled lame binaries? (in my case, Intel/10.5.x).

I'm out in the country and started playing with the remote streaming feature (stream.mp3), and MP3s play fine, but of course I canot stream any flacs as I currently do not have lame on my system.

I was quite happy to find a 3.98 version for Audacity, http://audacityteam.org/wiki/index.php?title=Lame_Installation#Lame_Library_v3. 98.2_for_Audacity.dmg, and installed that only to realise later that this is a library and not an executable file.

So back to my question - where's a good place for lame binaries? I've seen binaries from three or more years ago (e.g. the one from Blacktree) but thought I'd be able to find a more recent version...

chrisinparis
2009-05-09, 09:30
The lame website links to this guy:
http://www.thalictrum.com/index.php?pageid=6&artid=6

However I grabbed a later 3.98 build (from the same guy) from:
http://www.macupdate.com/info.php/id/18882

At first I tried putting lame as per the faq - http://www.slimdevices.com/su_faq.html#formats-binarywhere - to this folder:
~/Library/SlimDevices/bin

That did not seem to work (and I think I restarted my SC); so I decided to 'break the rules' and installed to:
/Library/PreferencePanes/SqueezeCenter.prefPane/Contents/server/Bin/darwin

I did not restart SC, and instead tried to play a FLAC. Even before getting to my log directory (to see what server.log had to say), the sweet tones of Sgt. Pepper's Lonely Hearts Club Band started to come through...

OK, time to make dinner now that's solved :)

bephillips
2009-07-28, 17:05
I'm in the process of transcoding my flacs with flac2mp3 v0.3.0rc1 and mostly it is working great, but every so often it will hang on a file and stop. I have looked at some of these files, and they verify OK, so it's not clear to me what the issue is, I'm not very conversant in working in the command line, I just do what I'm told. I see that both of the files below have backwards apostrophes in the file name. Could this be the problem? Thanks in advance for any help.

The error messages I get look like this:

Transcoding "Sonny_Sharrock/Live_In_New_York/03 - Elmo`s_Blues.flac"
sh: -c: line 0: unexpected EOF while looking for matching ``'
sh: -c: line 1: syntax error: unexpected end of file
"flac" --decode --stdout --silent "Sonny_Sharrock/Live_In_New_York/03 - Elmo`s_Blues.flac"| "lame" --noreplaygain --preset standard --quiet - "/Volumes/Triple Interface 1TB/mp3 mirror of flacs/Commercial P-Z mp3 mirror/Sonny_Sharrock/Live_In_New_York/62hHFYJlMD.tmp" failed with exit code 512


Transcoding "Tom_Waits/Blood_Money/05 - God`s_away_om_business.flac"
sh: -c: line 0: unexpected EOF while looking for matching ``'
sh: -c: line 1: syntax error: unexpected end of file
"flac" --decode --stdout --silent "Tom_Waits/Blood_Money/05 - God`s_away_om_business.flac"| "lame" --noreplaygain --preset standard --quiet - "/Volumes/Triple Interface 1TB/mp3 mirror of flacs/Commercial P-Z mp3 mirror/Tom_Waits/Blood_Money/YXMK29fMM0.tmp" failed with exit code 512

MrC
2009-07-28, 18:07
... I see that both of the files below have backwards apostrophes in the file name. Could this be the problem? Thanks in advance for any help.

yes, that's exactly what the problem is.

In the flac2mp3 script, just above this code:



$::Options{debug} && msg("$convert_command\n");

# Convert the file
my $exit_value = system($convert_command);


the $convert_command is created, surrounding the $quotedsrc variable that will be ultimately passed to the system() function (shown above):



my $convert_command =
"$flaccmd @flacargs \"$quotedsrc\""
. "| $lamecmd @lameargs - \"$quoteddest\"";


This is trying to protect the command and arguments from the shell, which will interpret metacharacters unless quoted. Unfortunately, double quotes do not protect backquotes, which is what you have in your file name. Thus, the shell keeps reading until it runs of out stuff to read, never finding that closing backquote (aka backtick).

if you were to replace the backslashed double quotes from above, with single quotes, as shown here in the script:



my $convert_command =
"$flaccmd @flacargs '$quotedsrc'"
. "| $lamecmd @lameargs - '$quoteddest'";


the script would then blowup on file names that contained any single quote.

So, the correct thing is to properly escape any backquotes in the variable quotedsrc, and then those would be protected.

Adding the two lines below should do the trick:



$quotedsrc =~ s/`/\\`/g;
$quoteddest =~ s/`/\\`/g;

my $convert_command =
"$flaccmd @flacargs \"$quotedsrc\""
. "| $lamecmd @lameargs - \"$quoteddest\"";


Edit: need to quote dest too, so need two lines of change.

bephillips
2009-07-28, 18:30
Thanks for the help. I did confirm that the ` character is the problem by fixing those file names. And that's something I should probably do anyway, as that's not correct in these cases. Though sometimes it is, as in song titles in Hawai`ian.

Thanks for the detailed explanation and suggestion, that's exactly the kind of explicit explanation and directions that I need.

BTW, I never got an answer to my question at the top of this page regarding lame settings, might you be able with that as well?

bephillips
2009-07-28, 18:50
Much of my flac library is unreleased live show recordings. These typically have a text file in the folder with info about the show and recording, most of which ideally ends up as tags. Still it would be nice to have these txt files included in the mp3 mirror. Is there some modification I could make to the script such that when a txt file is encountered in the source directory, that a copy of the txt file is placed in the appropriate location in the target directory?

agillis
2009-07-28, 20:10
Much of my flac library is unreleased live show recordings. These typically have a text file in the folder with info about the show and recording, most of which ideally ends up as tags. Still it would be nice to have these txt files included in the mp3 mirror. Is there some modification I could make to the script such that when a txt file is encountered in the source directory, that a copy of the txt file is placed in the appropriate location in the target directory?

I am already working on some mods to this script for VortexBox. These changes will mirror the cover art. I will set them to mirror .txt files as well.

MrC
2009-07-28, 22:42
Much of my flac library is unreleased live show recordings. These typically have a text file in the folder with info about the show and recording, most of which ideally ends up as tags. Still it would be nice to have these txt files included in the mp3 mirror. Is there some modification I could make to the script such that when a txt file is encountered in the source directory, that a copy of the txt file is placed in the appropriate location in the target directory?

It usually makes more sense to use existing tools, than to turn a basic tool into a swiss army knife.

Use rsync to mirror the extra (meta) files that you want. Eg:



rsync -av --include "*/" --include "*.txt" --exclude "*" --prune-empty-dirs ~/Music/ ~/MP3s/


Change ~/Music above to the root of your FLACs, and ~/MP3s to the root of your MP3s. The command above will mirror all .txt files. The nice thing about using existing tools is that you can easily add additional options, such as jpgs (above, adding an extra --include rule).

Be sure you see my edit above.

paulster
2009-07-29, 03:34
yes, that's exactly what the problem is.
Without diving into the code first to check, is this the same problem that causes flac2mp3 to barf on filenames with a $ sign in them? I've removed $ signs from the couple of filenames I had, but I'd happily implement a change to the code if it meant it wasn't going to catch me out in future (same with the backticks issue).

Paul

MrC
2009-07-29, 11:08
Without diving into the code first to check, is this the same problem that causes flac2mp3 to barf on filenames with a $ sign in them? I've removed $ signs from the couple of filenames I had, but I'd happily implement a change to the code if it meant it wasn't going to catch me out in future (same with the backticks issue).

Yes.

The $ char is also interpolated in double quotes. Change:


$quotedsrc =~ s/`/\\`/g;
$quoteddest =~ s/`/\\`/g;


to this:




my $shell_metas_in_dq = qr/[`\$]/;

$quotedsrc =~ s/($shell_metas_in_dq)/\\$1/go;
$quoteddest =~ s/($shell_metas_in_dq)/\\$1/go;

bephillips
2009-07-30, 16:39
yes, that's exactly what the problem is.



So, the correct thing is to properly escape any backquotes in the variable quotedsrc, and then those would be protected.

Adding the two lines below should do the trick:



$quotedsrc =~ s/`/\\`/g;
$quoteddest =~ s/`/\\`/g;

my $convert_command =
"$flaccmd @flacargs \"$quotedsrc\""
. "| $lamecmd @lameargs - \"$quoteddest\"";




Well the part of the script I found doesn't exactly match what you show, but adding the two lines you suggest does not seem to work. Please forgive my ignorance of coding, I don't have an understanding of the changes I'm making, just trying to find the code best matching what you show and modifying as instructed. I added


$quotedsrc =~ s/`/\\`/g;
$quoteddest =~ s/`/\\`/g;

above


my $convert_command =
"\"$flaccmd\" @flacargs \"$quotedsrc\""
. "| \"$lamecmd\" @lameargs - \"$tmpfilename\"";



and I get the following error when it encounters the backtick in these Hawai`ian track file names:

Transcoding "Various/Hawaiian Slack Key Kings/01 - Na Po`o Ka Ia.flac"
Use of uninitialized value in substitution (s///) at /Users/BradG4iB/Desktop/flac2mp3-0.3.0rc1/flac2mp3.pl line 502.
Use of uninitialized value in substitution (s///) at /Users/BradG4iB/Desktop/flac2mp3-0.3.0rc1/flac2mp3.pl line 503.

0: ERROR initializing decoder
init status = FLAC__STREAM_DECODER_INIT_STATUS_ERROR_OPENING_FIL E

An error occurred opening the input file; it is likely that it does not exist
or is not readable.
Writing tags to "0"


I'm grateful for any help in resolving this. Thanks for your patience.

MrC
2009-07-30, 18:20
Let's step back - I should have asked first. Which version of the script are you using?

bephillips
2009-07-30, 23:46
I mentioned in my original post: v0.3.0rc1

paulster
2009-07-31, 01:48
my $shell_metas_in_dq = qr/[`\$]/;

$quotedsrc =~ s/($shell_metas_in_dq)/\\$1/go;
$quoteddest =~ s/($shell_metas_in_dq)/\\$1/go;

I used this version of the modification to catch $ signs as well and I've just verified that it's working fine on Windows and Linux with both backticks and dollar signs, so I'm very happy with the solution.

LastDay
2010-07-30, 04:21
For me MelodyCan is the best software for different players. It can remove drm and convert files to different formats. You can try it_))

TheLastMan
2010-07-30, 06:30
Robin Bowes's flac2mp3 utility sounds like just what I need.

What is the best way to download Perl and get it working on Windows XP?
A pointer to a web page would be fine.

Ta.

aubuti
2010-08-01, 19:21
Try http://www.activestate.com/ , or more specifically, here: http://www.activestate.com/activeperl/downloads

RonM
2010-08-08, 06:33
I haven't read all 10 pages of post, but a cursory look-through didn't reveal a dBPoweramp suggestion.

Easily converts flac to mp3 (or whatever), including batch conversions, allows a variety of options re file location and naming conventions, the ripping application allows setting output to both flac and mp3 in different file locations, tags are handled well, etc, etc.

R.

aubuti
2010-08-08, 06:43
I haven't read all 10 pages of post, but a cursory look-through didn't reveal a dBPoweramp suggestion.
Actually dBpoweramp entered the discussion at post #60 (http://forums.slimdevices.com/showthread.php?p=327669&highlight=dbpoweramp#post327669).

Tony T
2010-08-12, 06:20
If you're on a Mac, you can convert using iTunes with: http://www.hydrogenaudio.org/forums/index.php?s=&showtopic=77672&view=findpost&p=681760

reverber
2010-08-12, 07:31
Coming a bit late into the discussion, but a cursory glance through the thread show no mention of MP3FS, a userspace file system that presents flac files as mp3, eliminating the need for storing mp3 copies of your flacs.

MP3FS lets one mount a directory of flac files and present them as mp3 files to an application. When one of these virtual mp3 files is accessed, it is converted on the fly for presentation to the requesting application. No more redundant collections to maintain.

Here is an article:
http://www.linux.com/archive/feed/57481

Cody

pcMusicNewbie
2010-09-22, 23:52
For those of you who running a Perl script similar to flac2mp3.pl
on a multi core machine, it is an easy task to parallelize your script
and greatly increase processing speed. Note - As flac conversion is a cpu
intensive task, running a flac job on every core will impair your computer's response time.

Add the following code in "the appropriate places" to your .pl file.


use Parallel::ForkManager;

# 4 for a quad core machine
my $pm = new Parallel::ForkManager(4);

# this is your main processing loop
while ("still processing flac files") {
$pm->start and next;

# convert a file

$pm->finish;
}

$pm->wait_all_children;

Hercules
2011-01-15, 15:27
I have a mixed FLAC and mp3 folder for my Squeezebox and I would like a separate folder for my portable player that contains all of the same music in MP3 only.

It sounds like flac2mp3 will help with the transcoding. What will it do when it encounters mp3 files? Will it ignore them, or will it copy them over to the portable library?

If it won't copy them over, I'd be interested to hear what tools other people use (on Windows) to do the syncing.

Thanks for any help.

aubuti
2011-01-15, 21:33
flac2mp3.pl (the Robin Bowes' script) will ignore the MP3 files.

My library is about 95% FLAC and 5% MP3, with MP3 duplicates of my FLAC files for my portable player. Basically I have three music folders.

\music\flac
\music\mp3
\music\common_mp3

FLAC files go in \music\flac, and the MP3 copies of those files go in \music\mp3. Files that I have _only_ in MP3 go in \music\common_mp3. Then put a Windows shortcut to \music\common_mp3 in the \music\flac folder, and put another Windows shortcut to \music\common_mp3 in the \music\mp3 folder. That way you can point SBS to \music\flac and it will find both your FLAC and MP3-only files. And you can point your portable player to \music\mp3, and it will find the files in both \music\mp3 and \music\common_mp3.

paulster
2011-01-15, 23:21
Yup, that's the best way to organise your library for this particular scenario, in my opinion.

andynormancx
2011-01-16, 03:08
There are several tools out there that will sync contents of folders. Take a look at Sync Toy from Microsoft for example. I just can't remember if it can selectively sync just particular file types.

WAD62
2011-01-17, 07:49
I use dBpoweramp to rip to FLAC for my main library, and the dBpoweramp batch converter to compress the FLAC library into a separate vbr mp3 library for my mobile devices.

A manual process, but it works nicely for me.

Peter314
2011-01-22, 15:53
Can rip to flac and mp3 simultaneously with the multi-encoder codec.

http://www.dbpoweramp.com/codec-central-utility.htm

cliver
2011-01-26, 04:34
I'm a bit late to the party but for what it's worth I use Easy CD-DA Extractor with Lame:
http://www.poikosoft.com/
It works fine for me even batch converting a large number of flac's across many directories.

Daria
2011-10-21, 04:59
I've started ripping my CD collection to FLAC using EAC. At some point I'd like to batch convert some of the FLACs to MP3. What's the best way to go about this?

Thanks,
Aylwin

I found a tutorial while having similar problems with converting recently and it helped me pretty much. They use Audio Converter Studio there. Might be useful for you as well.