Batch convert FLAC to MP3 with copying of folder structure. |
This is NOT a tech support forum.
Tech support questions go to foobar2000 Tech Support forum instead.
See also: Hydrogenaudio Terms of Service.
![]() ![]() |
Batch convert FLAC to MP3 with copying of folder structure. |
Jun 21 2010, 19:27
Post
#1
|
|
|
Group: Members Posts: 7 Joined: 21-June 10 Member No.: 81695 |
HELLo.
I want to convert my FLAC an APE collection to MP3 with highest quality, because FLAC is too big for my mp3 player. I know how to convert between formats (but if somebody give me correct parameters for mp3 settings I will be thankfull) Problem is that I want to convert it in batch proccess. Now I have my FLAC collection in directory "D:\Music\Flac\...." and I want to convert it automaticly to the folder d:\Music\MP3, with keeping of everything, like tags,album art in tag folder and subfolder structure and files. Thanks a lot for answer |
|
|
|
Jun 21 2010, 19:43
Post
#2
|
|
|
Group: Members Posts: 305 Joined: 12-September 07 Member No.: 46989 |
Copy the Flac folder to the MP3 folder, then use foobar to convert the contents of the MP3 folder (which currently contains FLACs) to MP3s and after that delete all flac files (for example from within foobar).
|
|
|
|
Jun 21 2010, 19:53
Post
#3
|
|
![]() Group: FB2K Moderator Posts: 4321 Joined: 1-November 06 From: Cincinnati Member No.: 37036 |
Use: CODE $replace(%path%,\FLAC\,\MP3\)\%filename% In the Name Format box of the Converter. This post has been edited by shakey_snake: Jun 21 2010, 20:21 -------------------- "It must be 'Take A Worm For A Walk' week!"
|
|
|
|
Jun 21 2010, 20:32
Post
#4
|
|
|
Group: Members Posts: 7 Joined: 21-June 10 Member No.: 81695 |
Copy the Flac folder to the MP3 folder, then use foobar to convert the contents of the MP3 folder (which currently contains FLACs) to MP3s and after that delete all flac files (for example from within foobar). Thanks |
|
|
|
Jun 21 2010, 20:49
Post
#5
|
|
|
Group: Members Posts: 7 Joined: 21-June 10 Member No.: 81695 |
Use: CODE $replace(%path%,\FLAC\,\MP3\)\%filename% In the Name Format box of the Converter. Thanks a lot, It seems interesting, but results are strange. For instance when I converting from directory d:\Hudba\__FLAC\Teatro Fatal - Divadlo Frizúr\ result is d:\Hudba\__FLAC\Teatro Fatal - Divadlo Frizúr\D-\Hudba\__MP3\Teatro Fatal - Divadlo Frizúr\01 Divadlo frizúr.flac\ that mean that it create in orginal directory subdirectory D-\Hudba\__MP3\Teatro Fatal - Divadlo Frizúr than in this subdirectory next subdirectory with original name of song \01 Divadlo frizúr.flac\ and in this subdirectory is song stored I use your command (modified to __FLAC and __MP3) in field called "Name format" And output folder seting "Same as source file" But biggest problem is that it doesn´t keep album art in tag, or dosn´t copy abum art file from source directory. |
|
|
|
Jun 21 2010, 21:11
Post
#6
|
|
![]() Group: FB2K Moderator Posts: 4321 Joined: 1-November 06 From: Cincinnati Member No.: 37036 |
Thanks a lot, It seems interesting, but results are strange. Yeah, for Output Path you'll need to select "Specify folder" and leave it blank. My guess is you selected "Source Track Folder".For instance... But biggest problem is that it doesn´t keep album art in tag, or dosn´t copy abum art file from source directory. It's a new file, so it never had artwork; there is nothing to "keep". But yes, the Converter doesn't transfer artwork from source tags to the new file's tags. No part of fb2k does artwork embedding, the Converter included. I believe dbPowerAmp does, if you need a program to do that. You can also embed art in the files post-conversion, using mp3tag. This post has been edited by shakey_snake: Jun 21 2010, 21:12 -------------------- "It must be 'Take A Worm For A Walk' week!"
|
|
|
|
Jun 21 2010, 21:34
Post
#7
|
|
|
Group: Members Posts: 457 Joined: 16-September 06 From: United States Member No.: 35261 |
I believe dbPowerAmp does, if you need a program to do that. You can also embed art in the files post-conversion, using mp3tag. Yes, dbpa will do it all including transferring the album art, embedded or in subdirectory as file, or both, as well as allowing you to have a dynamic naming string so that the new mp3 directory mirrors the structure of the old FLAC directory with the exception of the first level (i.e., flac vs mp3) |
|
|
|
Jun 21 2010, 22:01
Post
#8
|
|
|
Group: Members Posts: 7 Joined: 21-June 10 Member No.: 81695 |
Thanks people,
It seems that dbPowerAmp is good solution. So now few our of converting waiting for me. |
|
|
|
Jul 7 2010, 13:52
Post
#9
|
|
|
Group: Members Posts: 11 Joined: 2-June 07 Member No.: 43956 |
Thanks a lot, It seems interesting, but results are strange. Yeah, for Output Path you'll need to select "Specify folder" and leave it blank. My guess is you selected "Source Track Folder".For instance... But biggest problem is that it doesn´t keep album art in tag, or dosn´t copy abum art file from source directory. It's a new file, so it never had artwork; there is nothing to "keep". But yes, the Converter doesn't transfer artwork from source tags to the new file's tags. No part of fb2k does artwork embedding, the Converter included. I believe dbPowerAmp does, if you need a program to do that. You can also embed art in the files post-conversion, using mp3tag. I'm having the same trouble. I have a large directory of albums that I want to convert to mp3 and keep a similar directory structure in the new folder, so I decided to just try your method out on one track to see if I could get it to work. I'm trying to convert this: C:\Users\Mike\Music\Doors\flac\01 Doors - Doors (DCC Gold)\The Doors - The Doors (DCC Gold) - 01 - Break On Through (To The Other Side).flac To this: C:\Users\Mike\Music\Doors\mp3\01 Doors - Doors (DCC Gold)\The Doors - The Doors (DCC Gold) - 01 - Break On Through (To The Other Side).mp3 And in the preview window, Foobar is telling me it will do this: C-\Users\Mike\Music\Doors\flac\01 Doors - Doors (DCC Gold)\The Doors - The Doors (DCC Gold) - 01 - Break On Through (To The Other Side).flac\The Doors - The Doors (DCC Gold) - 01 - Break On Through (To The Other Side).mp3 I don't know why it's putting a dash after the C, and why it thinks it should make a subdirectory of a file. I selected "specify folder" and left it blank, as you said. And when I click OK, to make the conversion, it brings up a window asking me to choose a destination folder. What am I doing wrong here? |
|
|
|
Jul 7 2010, 14:04
Post
#10
|
|
|
Group: Validating Posts: 2424 Joined: 21-May 08 Member No.: 53675 |
because you put that pattern in name format and colon [:] is not valid character
you should select root folder in "Output path" setting and use some common sense in name pattern (check foobar help file) This post has been edited by 2E7AH: Jul 7 2010, 14:04 |
|
|
|
Jul 8 2010, 00:02
Post
#11
|
|
|
Group: Members Posts: 11 Joined: 2-June 07 Member No.: 43956 |
because you put that pattern in name format and colon [:] is not valid character you should select root folder in "Output path" setting and use some common sense in name pattern (check foobar help file) But I didn't put that pattern in the name format, though. What I put was: CODE $replace(%path%,\FLAC\,\MP3\)\%filename% And Foobar is trying to create a directory off a file (Which is impossible), and putting in a dash after the C. |
|
|
|
Jul 8 2010, 02:48
Post
#12
|
|
|
Group: Members Posts: 473 Joined: 25-June 05 Member No.: 22962 |
Well sure you did, what do you think %path% evaluates to? You need strip the "base" directory and not add another %filename%:
CODE $replace(%path%,c:\Users\Mike\Music,,\flac\,\mp3\) Change the "c:\users\.." to where you have pointed the converter. The converter dialogue has a preview of the output paths you can always check before you start a conversion, although it won't popup if you choose a preset from the submenu.
|
|
|
|
Jan 22 2012, 13:36
Post
#13
|
|
|
Group: Members Posts: 1 Joined: 22-January 12 Member No.: 96616 |
Hi,
Sorry to resurrect an old thread. I've had the same problem with the output from F2k and, while using %path% is a nice option, I would prefer to be able to copy artwork too. Currently, I use F2k to convert the FLAC files into mp3 in the source folders, and then use the following python script to move the mp3s into a new folder while copying the artwork and maintaining the directory structure. I thought I'd share the code as, until F2k is updated, this will be an issue. Notes on code: 1) Code is a hack, comes without warranty 2) Takes two folders - input folder with flac/mp3/artwork, empty output folder for mp3 3) Input folder must not be a subfolder of output folder or vice versa 4) Overwrites files in target directory without warning 5) Works on windows, could be modded for linux CODE print "-----------------------------------------------"
print "Application to relocate mp3 files whilst " print "preserving directory structure and album art" print "DL 2012" print "v. 0.1" print "-----------------------------------------------" import os, subprocess import tkFileDialog from Tkinter import * from tkMessageBox import askokcancel # moveit: file f relocates from src to dest def moveit( f , sorc , dest): fullPath = sorc + "\\" + f subprocess.Popen("move" + " \"" + fullPath + "\" " + " \"" + dest + "\" ",shell=True) return # copyit: file f duplicates in dest folder def copyit( f , sorc , dest): fullPath = sorc + "\\" + f subprocess.Popen("copy" + " \"" + fullPath + "\" " + " \"" + dest + "\" ",shell=True) return # parseDirs: reproduces directory structure, copys/moves files def parseDirs(srcMain , dstMain): src = srcMain dst = dstMain reparseDirs = [] # directories to reparse reparseDirs.append('') # outer loop : moves between directories while len(reparseDirs)>0: subfolder = reparseDirs.pop() print('\rreparseDirs:' + src + "\\" + subfolder) listOfFiles = os.listdir(src + "\\" + subfolder) # inner loop : moves files, creates directories for f in listOfFiles: temp = f temp=temp.lower() #verify file longer than 4 chars (e.g. at least x.xx) if len(temp)>3: ext = temp[len(temp)-4:len(temp)] else: ext = 'x.xx' # dummy output # identify file type if os.path.isdir(src + "\\" + subfolder + "\\" + f): # duplicate folder structure print('creating folder: ' + f) try: os.mkdir(dst + "\\" + subfolder + "\\" + f) except OSError: print 'folder already exists' reparseDirs.append(subfolder + "\\" + f) # search source dir for files elif ('flac' in ext)|('ape' in ext)|('m4a' in ext)|('alac' in ext): #ignore lossless print ('ignoring lossless file: ' + f) elif 'cue' in ext: #ignore cue print ('ignoring cue file: ' + f) elif 'mp3' in ext: #relocate mp3 print ('moving mp3 in file: ' + f) moveit(f , src + "\\" + subfolder, dst + "\\" + subfolder) else: #copy other file types print ('copying file: ' + f) copyit(f , src + "\\" + subfolder, dst + "\\" + subfolder) ########### Begin GUI Block class openDialog(Frame): def __init__(self, parent=None): Frame.__init__(self, parent) self.parent = parent # create a reference to the Tk() instance self.createWidgets() self.launchApp() def createWidgets(self): self.textDirIn = StringVar() self.textDirOut = StringVar() self.DirIn = Entry(self, width=70, textvariable=self.textDirIn) self.DirIn.pack() self.DirOut = Entry(self, width=70, textvariable=self.textDirOut) self.DirOut.pack() self.pack() def getDir(self): self.dirin=tkFileDialog.askdirectory() return self.dirin def launchApp(self): inputDir = self.getDir() self.textDirIn.set(inputDir) outputDir = self.getDir() self.textDirOut.set(outputDir) if askokcancel(title="Continue?", message="Continue using these folders?"): print 'Continue...' parseDirs(inputDir,outputDir) self.textDirIn.set('complete!') self.textDirOut.set('close window to finish') print 'complete: close window to finish' else: print 'Operation cancelled' self.textDirIn.set('cancelled') self.textDirOut.set('cancelled') ########### End GUI Block #### MAIN #### if __name__ == "__main__": root=Tk() openDialog(root) root.mainloop() |
|
|
|
Jan 23 2012, 01:30
Post
#14
|
|
|
Group: Members Posts: 20 Joined: 22-March 11 Member No.: 89188 |
Just in case it helps others, this is what I use when converting FLAC to MP3.
I am using an old version of Foobar (v.1.1.7) so you may need to tweak this slightly. My artwork is not embedded - I keep it as separate files (usually "cover.jpg") inside the relevant directories. Suppose FLACs are in C:\Users\Popeye\Music\Flacs 1) Create a suitable folder for the MP3 files e.g. C:\Users\Popeye\Music\MP3s 2) Load up your FLAC directory into Foobar and make sure all the files are highlighted 3) Right click on the files and select "Convert / ..." 4) Output Format Settings - Set the output type to MP3 and choose your quality setting 5) Destination Settings - Click on "Specify folder" and browse to whatever folder you created in step 1 6) Destination Settings - Use the following name formatting for "Convert each track to an individual file": $replace(%path%,C:\Users\Popeye\Music\Flacs,,.flac,) 7) Other Settings - Type the following in "Copy other files to the destination folder" to copy all artwork across: *.jpg;*.gif;*.png 8) Convert! What this does is to replace "C:\Users\Popeye\Music\Flacs" with "", and also the ".flac" with "". i.e. It strips down the path to just the subdirectory within your FLACs folder, together with the filename minus the .flac extension. The converter then appends this to your chosen MP3 directory, and automatically adds the MP3 extension. My understanding of $replace is that it works like this: $replace(A,B1,C1,B2,C2,B3,C3,...,Bn,Cn) It looks inside string A, replacing Bi with Ci for i=1,2,3,...,n. Bluto |
|
|
|
Feb 17 2012, 13:03
Post
#15
|
|
|
Group: Members Posts: 2 Joined: 17-February 12 Member No.: 97216 |
hey all,
thanks for this thread. really helped me out by converting my entire flac library to mp3 while keeping the same folder structure. for anyone else who wants to know im using foobar v1.1.10 select files, right click specify the output folder select "generate multi-tracks" paste this $replace( %directoryname%\ %filename%,\FLAC\,\MP3\) and it will do it perfectly. test with a few files first to make sure, but its working great for me. good luck. |
|
|
|
Feb 17 2012, 13:47
Post
#16
|
|
|
Group: Members Posts: 2 Joined: 17-February 12 Member No.: 97216 |
my bad.
the post above doesnt recreate all subfolders. this one does. $replace( $replace(%path%,.flac,),\FLAC\,\MP3\) just change .flac if you have other formats. |
|
|
|
Feb 17 2012, 14:09
Post
#17
|
|
|
Group: Members Posts: 260 Joined: 30-May 08 From: UK Member No.: 53927 |
You might also want to have a look at flac2mp3.py. As well as doing the conversion, it has lots of useful features, like using an MD5 checksum to work out which file(s) haven't changed since the last conversion and only converting those that have, and allowing you to only update the tags between your lossless and lossy library.
|
|
|
|
Feb 18 2012, 12:32
Post
#18
|
|
|
Group: Members Posts: 20 Joined: 22-March 11 Member No.: 89188 |
my bad. the post above doesnt recreate all subfolders. this one does. $replace( $replace(%path%,.flac,),\FLAC\,\MP3\) just change .flac if you have other formats. This doesn't seem to work for me - I get the same problem the original poster had. Foobar won't preserve the colon in C: if it appears in the full path, changing it to C- instead. The only way round this as far as I can tell is to specify a target folder, and strip the initial part of the path completely as in my post #14 above. Bluto This post has been edited by bluto: Feb 18 2012, 12:32 |
|
|
|
Jul 23 2012, 08:20
Post
#19
|
|
|
Group: Members Posts: 29 Joined: 11-May 06 Member No.: 30674 |
Bluto, you rock. Using your directions in post #14, I was able to eliminate a very tedious step from my conversion process. I specified my Mp3 output folder under "Output path", and then spliced my root FLAC source folder into your code, and Foobar now automatically creates the entire subdirectory structure in my specified MP3 destination. For the others, my code now looks like this:
CODE $replace(%path%,C:\Temp\MUSIC RIP,,.flac,) To Bluto, I get the same result whether the code is pasted under individual or multi-track output files, so I've left it at individual for now. To everyone else, if you try transcoding a FLAC which isn't in the source folder specified in the code, it's not going to work properly. Now, if we could find a way to have Foobar preserve the album art during the transcode, I'd be one happy camper. |
|
|
|
Jul 23 2012, 12:55
Post
#20
|
|
|
Group: Members Posts: 20 Joined: 22-March 11 Member No.: 89188 |
Glad it worked for you!
I don't think Foobar can copy across embedded artwork yet; I seem to recall this being raised before in the forum as something which wasn't possible. Personally, I don't like the thought of cluttering up music files with graphics data. Having a single "cover.jpg" file in each directory works fine for me, and is easy to change if necessary without altering the music files themselves. Regarding the Foobar options, I'm not at all sure what "Generate Multi-track files" means, given that there is already an option for "Merge all tracks into one output file". Bluto |
|
|
|
Jul 23 2012, 13:00
Post
#21
|
|
|
Group: Super Moderator Posts: 4348 Joined: 23-June 06 Member No.: 32180 |
Now, if we could find a way to have Foobar preserve the album art during the transcode, I'd be one happy camper. I don't think Foobar can copy across embedded artwork yet; I seem to recall this being raised before in the forum as something which wasn't possible. bluto is correct. Whether this will be addressed remains to be seen.
|
|
|
|
Oct 12 2012, 13:32
Post
#22
|
|
![]() Group: Members Posts: 1 Joined: 12-October 12 Member No.: 103808 |
hey all, thanks for this thread. really helped me out by converting my entire flac library to mp3 while keeping the same folder structure. for anyone else who wants to know im using foobar v1.1.10 select files, right click specify the output folder select "generate multi-tracks" paste this $replace( %directoryname%\ %filename%,\FLAC\,\MP3\) and it will do it perfectly. test with a few files first to make sure, but its working great for me. good luck. my bad. the post above doesnt recreate all subfolders. this one does. $replace( $replace(%path%,.flac,),\FLAC\,\MP3\) just change .flac if you have other formats. ryangoan you are a life saver. Thank you! |
|
|
|
![]() ![]() |
|
Lo-Fi Version | Time is now: 23rd May 2013 - 13:45 |