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

**URL:** <https://discourse.beets.io/t/copy-auto-tag-convert-delete-copied-data-add-converted-data-to-library/2452>\
**Category:** Help\
**Created:** [January 16, 2024, 3:49pm UTC](https://discourse.beets.io/t/copy-auto-tag-convert-delete-copied-data-add-converted-data-to-library/2452 "2024-01-16T15:49:55Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![ayushnix](https://yyz1.discourse-cdn.com/flex029/user_avatar/discourse.beets.io/ayushnix/32/799_2.png) [@ayushnix](https://discourse.beets.io/u/ayushnix)\
**Post date:** [January 16, 2024, 3:49pm UTC](https://discourse.beets.io/t/copy-auto-tag-convert-delete-copied-data-add-converted-data-to-library/2452/1 "2024-01-16T15:49:55Z")

</div>

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:

```yaml
---
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?

---

<div class="post-metadata">

**Author:** ![ayushnix](https://yyz1.discourse-cdn.com/flex029/user_avatar/discourse.beets.io/ayushnix/32/799_2.png) [@ayushnix](https://discourse.beets.io/u/ayushnix)\
**Post date:** [January 18, 2024, 8:16am UTC](https://discourse.beets.io/t/copy-auto-tag-convert-delete-copied-data-add-converted-data-to-library/2452/2 "2024-01-18T08:16:43Z")

</div>

Not sure if anyone’s reading this but I also opened a [discussion on GitHub](https://github.com/beetbox/beets/discussions/5083). For people here on Discourse, the [verbose output](https://github.com/beetbox/beets/files/13965276/beet-import-log.txt) 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:

```auto
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

```auto
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

```

---

<div class="post-metadata">

**Author:** ![ayushnix](https://yyz1.discourse-cdn.com/flex029/user_avatar/discourse.beets.io/ayushnix/32/799_2.png) [@ayushnix](https://discourse.beets.io/u/ayushnix)\
**Post date:** [January 19, 2024, 3:03pm UTC](https://discourse.beets.io/t/copy-auto-tag-convert-delete-copied-data-add-converted-data-to-library/2452/3 "2024-01-19T15:03:38Z")

</div>

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`

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

```

---

<div class="post-metadata">

**Author:** ![CoolingTool](https://yyz1.discourse-cdn.com/flex029/user_avatar/discourse.beets.io/coolingtool/32/820_2.png) [@CoolingTool](https://discourse.beets.io/u/CoolingTool)\
**Post date:** [April 26, 2024, 4:31am UTC](https://discourse.beets.io/t/copy-auto-tag-convert-delete-copied-data-add-converted-data-to-library/2452/4 "2024-04-26T04:31:47Z")

</div>

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.
