ReplayGain metaflac backend alters input files
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 78/100
Research direction
Start in beetsplug/replaygain.py at lines 709-733, focusing on the metaflac backend's ReplayGain write and read steps. Run the minimal import reproduction with copy enabled and inspect both the source and library files using metaflac --list. Done means the source file is unchanged while the copied library file still receives the ReplayGain tags.
Written by the indexing model from the issue text.
Description
Problem
When using the ReplayGain plugin with the metaflac backend, the current implementation works in two parts:
- Write the ReplayGain tags to the input files (source: beetsplug/replaygain.py#L709-L712).
- Read the ReplayGain tags from the input files (source: beetsplug/replaygain.py#L714-L733).
This leads to altering the input files, which corrupts files that shouldn't be touched, especially when the input files are not in the final destination (e.g., during import).
metaflac can use --scan-replay-gain to read the ReplayGain tags without altering the input files (since FLAC 1.3.2, released on 01-Jan-2017 - discussed in https://github.com/beetbox/beets/issues/1203).
Using --scan-replay-gain instead of --add-replay-gain would fix this issue.
Minimal reproduction
-
config.yaml:directory: /music import: copy: yes replaygain: auto: yes backend: metaflac -
Import a FLAC file with no ReplayGain tags:
beet import /downloads/file.flac -
Check the ReplayGain tags on the copy beets created in the library:
metaflac --list /music/.../file.flac- tags are present, as expected. -
Check the ReplayGain tags on the original file that was imported from:
metaflac --list /downloads/file.flac- tags were also written here, unexpectedly.
Setup
- OS: Debian GNU/Linux 13.6 (trixie) in a Visual Studio Devcontainer
- Python version: 3.13.5
- beets version: 2.13.1 (released on 29-Jul-2026)
- Turning off plugins made problem go away (yes/no): N/A
AI disclaimer
I have used AI to help me write this issue report.
- Dominant language
- Python
- Stars
- 15.7k
- Forks
- 2.1k
- Avg merge
- 3d 13h
- Merged PRs (30d)
- 29
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from beetbox/beets
-
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
-
web
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
-
needinfo remove-command
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
-
Difficulty 3/5 1-2 days Newbie friendliness 74/100
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100