beetbox / beets

music library manager and MusicBrainz tagger
http://beets.io/
MIT License
12.97k stars 1.83k forks source link

convert: Granular control over which formats to convert, especially in auto mode #3328

Open ghost opened 5 years ago

ghost commented 5 years ago

I'm trying to use beets to automatically recompress my FLAC albums before adding them to the library. It's a FLAC to FLAC conversion. I'd like to use the maximum compression ratio (--best option). Currently there's a convert plugin for beets that seems to work only with music already in the library.

Is beets the right tool for the job? Or should I manually recompress music with some custom script before adding to the beets library?

sampsyo commented 5 years ago

The convert plugin is indeed what you want! Have you checked out its auto mode?

ghost commented 5 years ago

I tried the following configuration, but it seems it doesn't work:

convert:
  auto: yes
  format: flac
  formats:
    flac:
      command: flac --best --verify $source
      extension: flac

Am I missing something?

sampsyo commented 5 years ago

I don't see anything obviously wrong! Maybe a little more digging and/or context will help reveal what's happening.

wisp3rwind commented 5 years ago

Actually, that's not a thing that convert currently supports. In auto mode, it applies the same logic as always, i.e. it will not transcode tracks that already match the target format (i.e. FLAC). Maybe one way to implement this feature would be by making the auto option accept the values auto: [no|yes|always] using confits OneOf? Or maybe better and more flexible, add an additional always_convert_on_import: <formats> option? That might be more sensible as it would enable things like always recompressing lossless formats, but never touching lossy files.

sampsyo commented 5 years ago

Aha; good point! We already have that “never convert lost files” option, but generalizing that to a set of rules where you say which formats should and should not be converted seems like a good idea.