Skip to main content

Topic: Prefer flac over mp3 for the same title in media library (Read 2648 times) previous topic - next topic

0 Members and 1 Guest are viewing this topic.
  • olfab
  • [*]
Prefer flac over mp3 for the same title in media library
Hi forum,

I ripped all my CDs into flac files for playback on my stereo on transcoded the flac files to mp3 for playback on the radio on my car. The folder structure is like this: Artist/Album/["flac files", Mp3/"mp3 files"]. Consequently each title shows up twice in the media library once as flac file and once as mp 3 file.

Is there a way to setup a filter that prefers flac files over mp3 files if there are two files with the same name?

If there is no way, any suggestions how to cope with the problem?

Thanks,
Fabian

  • Midiman
  • [*]
Prefer flac over mp3 for the same title in media library
Reply #1

  • olfab
  • [*]
Prefer flac over mp3 for the same title in media library
Reply #2
Thank you for your answer, Midiman.

But this is not the solution I'm looking for. Your solution means I have to duplicate my whole folder structure for every audio file type. For example I would need these folders for every album:
/Music/Flac/"Artist A"/"Album A"/"Track 1.flac"
/Music/Mp3/"Artist A"/"Album A"/"Track 1.mp3"
/Music/"Artist A"/"Album A"/[Cover Art, etc]

And for Apple I would also need:
/Music/Alac/"Artist A"/"Album A"/"Track 1.mp4"

Fabian
  • Last Edit: 28 January, 2013, 06:04:25 PM by olfab

  • kode54
  • [*][*][*][*][*]
  • Administrator
Prefer flac over mp3 for the same title in media library
Reply #3
You could make autoplaylist/media library queries which filter against %codec%, but that doesn't actually handle the case of duplicates, but merely lets you restrict a query to files which either match or do not match a particular codec or codecs.

Maybe a query operator could be implemented, like PREFER (string) IS/HAS/IN (value/value set), which would be able to pick one track out of sets of tracks where all the metadata is the same except for what (string) resolves to. Of course, I don't know what sort of nightmare overhead that would incur on a query operation, especially since it already calls for the operation of multiple tracks per single track query, in order to find the almost complete tag duplicates.

Closest I could think of how something like this would be implemented is that all other operators of the query except for PREFER would be sorted out into a list first, or if no other operators, then the entire input list. Then the entire list would have its meta/info text fields hashed except for the fields specified by any PREFER operators. The query would automatically pass out any unique hashes. Any duplicate hashes would pass through the PREFER operator to pick out a single preferred track.

I can think of how this sort of thing may end up being an O(N^2) nightmare, or could be abused all sorts of ways for other types of queries. Maybe it should only be a PREFER_CODECS type query instead, since it really doesn't make any sense for any other purpose.
  • Last Edit: 28 January, 2013, 11:34:28 PM by kode54

  • Midiman
  • [*]
Prefer flac over mp3 for the same title in media library
Reply #4
Thank you for your answer, Midiman.

But this is not the solution I'm looking for. Your solution means I have to duplicate my whole folder structure for every audio file type. For example I would need these folders for every album:
/Music/Flac/"Artist A"/"Album A"/"Track 1.flac"
/Music/Mp3/"Artist A"/"Album A"/"Track 1.mp3"
/Music/"Artist A"/"Album A"/[Cover Art, etc]

And for Apple I would also need:
/Music/Alac/"Artist A"/"Album A"/"Track 1.mp4"

Fabian


Well, that is not quite true. If you look at what I said, you only need 3 main directories - one for master FLAC - one for copy MP3 - one for everything else. Everything else contains any files you can possibly think of that you do not have FLAC master copies of. You only need one copy of the "Cover Art" files, surely? For use with fb2k? The iPod won't be using the Cover Art JPG files etc.

As for your Apple directory above, please explain why you need an MP4 (M4A/AAC?) copy of a FLAC for your iPad/iPod. iPad/iPod can quite happily play the MP3 files. If you bought an "Apple" file off iTunes, it is the "master" so it goes in the "Everything Else" folder structure.

Your only advantage of your folder structure is less high level directories? However, if you use the folder structure I suggest, then you can mass convert - using fb2k - FLAC to MP3 with one click of a button - and not redo MP3 conversion for any file that already exists as MP3. There is no way to do that via your folder structure using a recursive technique.

You choose what is easiest for you. I thought long and hard about this problem before I devised my folder structure - and it has worked so far ;-)

Mike



  • kode54
  • [*][*][*][*][*]
  • Administrator
Prefer flac over mp3 for the same title in media library
Reply #5
Ooh, excellent, a reply that doesn't involve some insane coding solution like I proposed. Bravo, sir.

Prefer flac over mp3 for the same title in media library
Reply #6
Thanks Midiman. I have been looking for a solution for this for a long time as well. I already have seperate 'FLACS' and 'MP3s'  folders but my problem is how to seperate the mp3s that are unique from the ones that I have FLAC copies of
Is there an easy way to find the unique mp3s so I can put them into a seperate folder?
Thanks

  • BenB
  • [*][*][*][*][*]
Prefer flac over mp3 for the same title in media library
Reply #7
Is there a way to setup a filter that prefers flac files over mp3 files if there are two files with the same name?

Not exactly. I know of no way for foobar to prefer a file type.

If there is no way, any suggestions how to cope with the problem?

If I'm understanding your folder structure correctly, you have a folder named "Mp3" (containing the mp3 duplicates) within your album folders. If so, you could create a new view in Album List (or if you use Facets, a new filter/column) which filters out those mp3 duplicates. Something such as the following should work:

Quote
$if($not($strcmp(%directoryname%,Mp3)),display this)

where "display this" would be replaced with additional title formatting of your choosing. Basically, what it should do is return all files not in a folder named "Mp3". It should not filter out any files that have "Mp3" in their directory name.

edited for clarification
  • Last Edit: 29 January, 2013, 02:36:52 PM by BenB

  • olfab
  • [*]
Prefer flac over mp3 for the same title in media library
Reply #8
Thank you for your answers!

@Mike: I really appreciate your solution since it circumvents the limitations of foobar in an easy way. But I just don't want to cope with twice the directory structures. If I listen at home to music (flac file) and decide to include it on the next cd for the radio in my car I would have to go all the way to the correspondent mp3 file. This is pretty tedious.

@BenB: I think this doesn't work since I use the DarkOne theme. What a pity.

  • Midiman
  • [*]
Prefer flac over mp3 for the same title in media library
Reply #9
Thanks Midiman. I have been looking for a solution for this for a long time as well. I already have seperate 'FLACS' and 'MP3s'  folders but my problem is how to seperate the mp3s that are unique from the ones that I have FLAC copies of
Is there an easy way to find the unique mp3s so I can put them into a seperate folder?
Thanks

A good question ;-) I fixed my entire directory structure with some VB.NET coding - however it may be possible to code something with VB SCRIPT, I suppose. My VB.NET app compares 2 directories recursively and reports differences where each sub folder is different. To do this, the file extension is ignored - thus if I have a FLAC sub folder with 15 .FLAC files I will report as a warning any folder which does not have 15 .MP3 files - all with exactly the same name of course!

When I was writing the original code, I actually wrote a separate routine along the lines of:

MP3 folder is "master" - FLAC folder is "copy" - if xxx.MP3 exists in "master" and xxx.FLAC does not exist in "copy" then MOVE xxx.MP3 to "\Other" folder structure, retaining the original folder structure. In VB.NET it is easy to get the filenames for all files in a folder and easy to recursively call the same routine for each sub folder in each folder.

Normally, FLAC folder is "master" and MP3 folder is "copy", of course. The program will generate FLAC and LAME commands to convert FLAC to MP3 for all missing MP3 files. The commands are simply written to a BAT file and then executed. However, fb2k can do this action with no programming effort whatsoever and copy the tags from FLAC to MP3 as well. I would be happy to give my VB.NET EXE to anyone who is interested, but I have written no documentation other than tooltips - and the GUI is not the prettiest - however it is functional. So, if you wanted it, you would have to experiment to see how it works ;-)

Mike



  • BenB
  • [*][*][*][*][*]
Prefer flac over mp3 for the same title in media library
Reply #10
@BenB: I think this doesn't work since I use the DarkOne theme. What a pity.

It (or a modification thereof) would likely still work, but the problem would be locating the relevant title formatting for that skin. If you are inclined to go that route, I suggest contacting the theme's developer on how to go about doing it.

On the other hand, the theme makes use of the Quick Search Toolbar component (it's the search located in the upper right corner). A query such as:

Code: [Select]
"$if($strcmp(%directoryname%,Mp3),true,false)" IS false

should filter out your mp3 duplicates and, of course, changing the query to:

Code: [Select]
"$if($strcmp(%directoryname%,Mp3),true,false)" IS true

should return only your mp3 duplicates.

EDIT:
You might also try one of the following:

Code: [Select]
NOT directoryname IS Mp3
NOT %directoryname% IS Mp3
  • Last Edit: 29 January, 2013, 08:01:04 PM by BenB

Prefer flac over mp3 for the same title in media library
Reply #11
Thanks Midiman....sounds very complicated but I am willing to give it a try.  Your .exe would be appreciated

Prefer flac over mp3 for the same title in media library
Reply #12
If I put all my flacs and mp3s in a playlist. Is there a query I could put in a search that would show duplicate files, regardless of their codec?

  • EpicForever
  • [*][*][*][*][*]
Prefer flac over mp3 for the same title in media library
Reply #13
I found other solution.
1. Open Advaced Properties / Display / Properties Ddialog / Standard fields. Add there something like Keywords=KEYWORDS or anything else that you want (Transcoded=TRANS for example). This will add field named "Keywords" (or Transcoded) to your Properties dialog.
2. For files that have dupliacates in different formats/codecs put in "Keywords" words identificating that fact, like "transcode" (in MP3 files for example) or "Yes" in "transcoded" field. You can also use "Comment" field for the same purposes as proposed "Keywords". It will add tag fields named "TRANS" (or "KEYWORDS" or whatever you choose) to your files, and thus modify them.
3. Install this component: http://www.foobar2000.org/components/view/foo_skip
4. In Advanced Properties / Playback / Skip Tracks  put "%keywords% HAS transcode" (without quotations) or "%comment% HAS transcode" or %trans% IS yes". "HAS" and "IS" words are case sensitive and must be all uppercase! You can uncheck all 3 additional checkboxes. I even recommend having the first unchecked.
5. From main window menu choose Playback and then tick "Skip tracks & use bookmarks". In Preferences / Keyboard shortcuts you can add keyboard shortcut for this option, that will allow you to enable it or disbale easily.

This is how it works here. Without any modifications to file system structure. However it require your personal effort to determine files with duplicates and to properly tag them, and to update this information everytime you add new files and their duplicates to your collection and playlist.

Prefer flac over mp3 for the same title in media library
Reply #14
Sounds like a lot of work, but if it works for you....... I literally want to find the duplicate mp3s and delete them.....not bothered about tagging them. I just want FLAC masters and mp3s of tunes that I haven't got FLAC copies for.
Anyone thought of a simple solution for this yet?
Midiman what happened to the .exe you were going to send me?
Thanks

  • Midiman
  • [*]
Prefer flac over mp3 for the same title in media library
Reply #15
Midiman what happened to the .exe you were going to send me?
Thanks

Oops - will get a move on re this. I am in the middle of writing some documentation - I will let you know when that is done and all is available for download.