Copy, Auto Tag, Convert, Delete Copied Data, Add Converted Data to Library

I’m trying to convert my FLAC music files to OPUS. I want to auto-tag the OPUS files and add those OPUS files to my beets library. However, I’m not able to configure beets to do this.

Here’s the config.yaml file that I’m using:

---
library: "~/.local/share/beets/library.db"
directory: "/data/music/opus"
asciify_paths: true

import:
  write: true
  copy: true
  move: false
  log: "~/.cache/beets/import.log"

musicbrainz:
    extra_tags: [year]
    https: yes

plugins: [convert]
convert:
    auto: true
    format: opus
    formats:
        opus:
            command: opusenc --quiet --bitrate 160 --vbr $source $dest
            extension: opus
    never_convert_lossy_files: true
    dest: "/data/music/opus"

My FLAC music collection is in the /data/music/flac directory. I want to

  1. copy the FLAC albums inside /data/music/flac to /data/music/opus
  2. convert the those copied files to OPUS
  3. auto-tag those OPUS files
  4. add those OPUS files to my library directory
  5. remove the copied FLAC files in /data/music/opus

Alternatively,

  1. copy the FLAC albums inside /data/music/flac to /data/music/opus
  2. auto-tag those FLAC files
  3. convert those FLAC files to OPUS files
  4. add those OPUS files to my library directory
  5. remove the copied FLAC files in /data/music/opus

Is it possible to configure beets to do this in a single beets command?

Not sure if anyone’s reading this but I also opened a discussion on GitHub. For people here on Discourse, the verbose output from beet -v import is mentioned.

In addition to the behavior described before, the tags from the original FLAC files aren’t preserved when automatically converting them to OPUS. Here’s the mediainfo output of a FLAC file:

General
Complete name                            : /home/user/downloads/Carbon Based Lifeforms - ALT-01 (2016) WEB FLAC/01. Euphotic - Live Version.flac
Format                                   : FLAC
Format/Info                              : Free Lossless Audio Codec
File size                                : 40.0 MiB
Duration                                 : 7 min 36 s
Overall bit rate mode                    : Variable
Overall bit rate                         : 736 kb/s
Album                                    : ALT:01
Album/Performer                          : Carbon Based Lifeforms
Track name                               : Euphotic - Live Version
Track name/Position                      : 01
Track name/Total                         : 09
Performer                                : Carbon Based Lifeforms
Genre                                    : Ambient/Psybient
Recorded date                            : 2016
Cover                                    : Yes
Cover type                               : Cover (front)
Cover MIME                               : image/jpeg

Audio
Format                                   : FLAC
Format/Info                              : Free Lossless Audio Codec
Duration                                 : 7 min 36 s
Bit rate mode                            : Variable
Bit rate                                 : 732 kb/s
Channel(s)                               : 2 channels
Channel layout                           : L R
Sampling rate                            : 44.1 kHz
Bit depth                                : 16 bits
Compression mode                         : Lossless
Stream size                              : 39.8 MiB (99%)
Writing library                          : libFLAC 1.3.1 (2014-11-25)
MD5 of the unencoded content             : 2EB53D2AF86EF41735B3F34B133A4B9F

Here’s the mediainfo output of the corresponding OPUS file created by beets

General
Complete name                            : /data/music/opus/Carbon Based Lifeforms/ALT_01/01 Euphotic (Live Version).opus
Format                                   : Ogg
File size                                : 9.37 MiB
Duration                                 : 7 min 36 s
Overall bit rate                         : 172 kb/s
ENCODER_OPTIONS                          : --bitrate 160 --vbr

Audio
ID                                       : 1817977417 (0x6C5C2249)
Format                                   : Opus
Duration                                 : 7 min 36 s
Channel(s)                               : 2 channels
Channel layout                           : L R
Sampling rate                            : 44.1 kHz
Compression mode                         : Lossy
Writing library                          : libopus 1.4, libopusenc 0.2.1

For posterity, the solution was to switch to ffmpeg instead of opusenc. Not sure why using opusenc here doesn’t work as expected because opusenc preserves metadata when used to convert FLAC to OPUS but when used with beets, opusenc doesn’t work.

Here’s the relevant section of config.yml

convert:
  auto: true
  format: opus
  formats:
    opus:
      command: ffmpeg -i $source -y -vn -acodec libopus -ab 160k $dest

Hey, sorry for bumping this old post, but I was having this issue too and was able to fix it without switching to ffmpeg by setting convert.threads to 1.

1 Like