Skip to main content

Topic: flac to mp3 (Read 15612 times) previous topic - next topic

0 Members and 1 Guest are viewing this topic.
flac to mp3
hi

is it possible to transcode from flac to mp3 without using any of the available gui's and without creating a wave file from the flac file first and then converting that wave file to mp3.

i would like to understand how this can be done (if it can be done).

Ax

edit-----------
basically, what command line could be used to do this?  im guessing i would need to make use of the stdin and stdout?

Thanks
  • Last Edit: 23 August, 2005, 02:59:48 PM by AlexanderTG

  • Digisurfer
  • [*][*][*][*]
flac to mp3
Reply #1
foobar2000 0.8.3 (foo_flac 1.0.17) + LAME 3.96.1 works fine for me.

Edit: Yeah I know that means a gui, so what it works. 
  • Last Edit: 23 August, 2005, 03:13:55 PM by Digisurfer

  • NumLOCK
  • [*][*][*][*][*]
  • Developer
flac to mp3
Reply #2
Hi,

At least in linux, you can try something like:
Quote
flac -d --stdout myfile.flac | lame -preset standard - myfile.mp3


Try Leeloo Chat at http://leeloo.webhop.net

flac to mp3
Reply #3
does that mean it cant be done in a win32 environment?

how do programs like foobar2000 pass a flac stdout to the lame encoder?
  • Last Edit: 23 August, 2005, 03:22:11 PM by AlexanderTG

  • tycho
  • [*][*][*][*]
flac to mp3
Reply #4
Sure it can be done in a win32 console window (Start | Run | cmd.exe)
Make sure flac.exe and lame.exe are in one of the directories in the %PATH% variable (or specify full path to them):
Code: [Select]
C:\> flac.exe -d --stdout myfile.flac | lame.exe --preset fast standard - myfile.mp3

flac to mp3
Reply #5
cool that works!

so would i be right in saying that you can do the same thing using monkey's flac wavpack etc stdout to mp3 aac ogg mpc ?

would the command lines be the same only differences in the quality setting of the lossy format and the encoder names?

  • tycho
  • [*][*][*][*]
flac to mp3
Reply #6
Quote
cool that works!

so would i be right in saying that you can do the same thing using monkey's flac wavpack etc stdout to mp3 aac ogg mpc ?

would the command lines be the same only differences in the quality setting of the lossy format and the encoder names?
[a href="index.php?act=findpost&pid=322137"][{POST_SNAPBACK}][/a]

Yes, but all encoders /decoders has their way to specify stdin/stdout, although most of the time its by giving "-" as file name, or specifying somthing like --stdout as in the flac decoder.

flac to mp3
Reply #7
thats excellent

while the commandline script was running i clicked contro alt delete to bringup the taskbar and noticed there was no lame or flac to be seen.  instead i saw this



is this normal? if it is how can i tell which one is lame and which one is flac?

  • gfngfgf
  • [*][*][*][*][*]
flac to mp3
Reply #8
Just a guess here, but MP3 and FLAC are designed for fast decoding, relatively slow encoding (at least, that's what I think), so the one using more of the CPU is probably LAME.  Just a guess.

flac to mp3
Reply #9
Quote
is it possible to transcode from flac to mp3 without using any of the available gui's and without creating a wave file from the flac file first and then converting that wave file to mp3.

Quote
Sure it can be done in a win32 console window (Start | Run | cmd.exe)
Make sure flac.exe and lame.exe are in one of the directories in the %PATH% variable (or specify full path to them):
Code: [Select]
C:\> flac.exe -d --stdout myfile.flac | lame.exe --preset fast standard - myfile.mp3

I'll just add that your mp3's will be missing tags from your flac files if they had them. AFAIK, the only way to get them out is with metaflac...

Mark

  • Daffy
  • [*][*][*]
flac to mp3
Reply #10
Someone asked for something similar out of LamedropXPd a while ago and it never happened, although john33 said "maybe".  Perhaps he forgot or felt it wasn't necessary.  Would be nice though....

flac support in lamedropxpd?

flac to mp3
Reply #11
Same commandline a bit shorter:
Code: [Select]
flac -dc myfile.flac | lame -V 2 --vbr-new - myfile.mp3

Ofcourse it would have been cool to be able to pass on the tags on commandline. I don't know anyway to do that.

BTW. The Lame options are for new versions. If you use 3.90.3 you shoud use --alt-preset standard or --alt-preset fast standard ofcourse...
"ONLY THOSE WHO ATTEMPT THE IMPOSSIBLE WILL ACHIEVE THE ABSURD"
       - Oceania Association of Autonomous Astronauts

  • Dilby¬©
  • [*]
flac to mp3
Reply #12
This is what you want, includes windows rightclick menu integration.  Only problem is that it doesnt work with filenames with spaces, use Tag&Rename to do a batch rename to relpace spaces with underscores.  It even tags the output files.

http://www.hydrogenaudio.org/forums/index....showtopic=27026

The link in the last post at the bottom.

  • Klyith
  • [*][*][*][*]
  • Members (Donating)
flac to mp3
Reply #13
Aargh, Dilby, I was just writing a how-to on batch files and right click. I shoulda known that someone here would have already done that. Good thing I previewed or I would have looked silly.

Though I think anticrust's batch file is a bit over-complex... Having to interact with a batch is annoying, as are the limits for file locations. It's much easier just to have several smaller scripts that do one job. I also prefer operating on files, not directories. But the bits for transferring tags are neat, I may have to copy those.

flac to mp3
Reply #14
Quote
Though I think anticrust's batch file is a bit over-complex... Having to interact with a batch is annoying, as are the limits for file locations. It's much easier just to have several smaller scripts that do one job. I also prefer operating on files, not directories. But the bits for transferring tags are neat, I may have to copy those.
[a href="index.php?act=findpost&pid=322215"][{POST_SNAPBACK}][/a]

If you make some that differs in various aspects, it would ofcourse be nice if you posted yours for others to look at.....
"ONLY THOSE WHO ATTEMPT THE IMPOSSIBLE WILL ACHIEVE THE ABSURD"
       - Oceania Association of Autonomous Astronauts

  • Klyith
  • [*][*][*][*]
  • Members (Donating)
flac to mp3
Reply #15
Quote
If you make some that differs in various aspects, it would ofcourse be nice if you posted yours for others to look at.....

I will definitely do so after I figure out how it all works. It uses some code I haven't seen before. Maybe I can use tag.exe to do tags. That might be faster and easier, and it would also be more universal.

Here's what I had written out before. The batch file is ultra simple, but the instructions for binding to file associations may be helpful for people who don't want to use an installer...

You can make a batch file with this:
Code: [Select]
[path\]flac.exe -dc %1 | [path\]lame.exe [lame options] - %1.mp3
[pause]
[] = optional. The "pause" will make the command box wait for you to press a key before it closes so you can see what happened. I particularly like that because I use --verbose in the lame options.

Then save the batch file somewhere (if you put it in the same directory as flac.exe and lame.exe you don't need the path. Now you can associate that to a new entry in the right click actions for all flac files.

Then, in and windows folder, open tools -> folder options -> file types. Find & select the entry for flac, and click the "advanced..." button, and then the "new..." button. In the box that pops up, the first text entry is for the name that will be on the right menu. You can call it anything you want, something like "Flac to Mp3" would be good. Then click the "browse" and find your batch file. After you hit ok, you need go to the end of the entry and add " %1". That's space percent one, nothing else. Now hit OK three times.

Now you can right click any flac file and automatically make an mp3 copy. Just be sure to only do one at a time, because if you have multiple files selected and try it they will all go at once instead of one at a time. If you want to do a bunch use something like foobar that can make a queue.

  • legg
  • [*][*][*]
flac to mp3
Reply #16
a batch that would convert all flac files in a directory to mp3?

Code: [Select]
for %%i in (*.flac) do [path\]flac.exe -dc %%i | [path\]lame.exe [lame options] - %%~ni.mp3
[pause]


BTW, the ~n is meant to remove the .flac extension of the filename, so that myfile.flac be converted to a myfile.mp3 file and not to a myfile.flac.mp3 file.

flac to mp3
Reply #17
Quote
a batch that would convert all flac files in a directory to mp3?

Code: [Select]
for %%i in (*.flac) do [path\]flac.exe -dc %%i | [path\]lame.exe [lame options] - %%~ni.mp3
[pause]


BTW, the ~n is meant to remove the .flac extension of the filename, so that myfile.flac be converted to a myfile.mp3 file and not to a myfile.flac.mp3 file.
[a href="index.php?act=findpost&pid=322239"][{POST_SNAPBACK}][/a]

That works. Although not if there are any spaces in filenames. An a bit more aesthetically pleasing version (requires lame.exe and flac.exe in searchpath, e.g. System32) could be like the following. But no tags will still obviously be copied over. For that more advanced scripting will be required.

Code: [Select]
@echo off
title flac2mp3
for %%i in (*.flac) do flac.exe -dc %%i | lame.exe -V 2 --vbr-new - %%~ni.mp3
echo.
echo.
echo All done!
echo Hit any key to exit.
pause > nul
exit
"ONLY THOSE WHO ATTEMPT THE IMPOSSIBLE WILL ACHIEVE THE ABSURD"
       - Oceania Association of Autonomous Astronauts

  • legg
  • [*][*][*]
flac to mp3
Reply #18
Quote from: Mr_Rabid_Teddybear,Aug 23 2005, 09:52 PM

Code: [Select]
@echo off
title flac2mp3
for %%i in (*.flac) do flac.exe -dc "%%i" | lame.exe -V 2 --vbr-new - "%%~ni.mp3"
echo.
echo.
echo All done!
echo Hit any key to exit.
pause > nul
exit


That should do the trick to include filenames with spaces.