beetbox / beetbox/beets

Beets replaygain with ffmpeg writing 0 values

Open
#6,173 2 comments 0 reactions 0 assignees View on GitHub
replaygain
Dominant language
Python
Stars
15.7k
Forks
2.1k
Avg merge
4d 21h
Merged PRs (30d)
31

Description

### Problem

Running this command in verbose (`-vv`) mode:

```sh
$ beet -vv (.plugin paths: []
Loading plugins: beatport4, duplicates, edit, embedart, fetchart, ftintitle, importreplace, info, lastgenre, lyrics, musicbrainz, permissions, replaygain, scrub, zero
fetchart: lastfm: Disabling art source due to missing key
fetchart: google: Disabling art source due to missing key
lastgenre: Loading whitelist /home/max/.local/share/pipx/venvs/beets/lib/python3.12/site-packages/beetsplug/lastgenre/genres.txt
lastgenre: Loading canonicalization tree /home/max/.local/share/pipx/venvs/beets/lib/python3.12/site-packages/beetsplug/lastgenre/genres-tree.yaml
Sending event: pluginload
library database: /home/max/.config/beets/data/musiclibrary.db
library directory: /home/max/nas/media/music
Sending event: library_opened
Parsed query: AndQuery([PathQuery('path', b'/home/max/nas/media/music/albums/Mefjus/FabricLive 95_ Mefjus/01 Decypher.flac', fast=True, case_sensitive=True)])
Parsed sort: NullSort()
replaygain: Analyzing 1 tracks ~ ffmpeg backend...
replaygain: analyzing Mefjus & Kasra - FabricLive 95: Mefjus - Decypher feat. Kasra
replaygain: executing ffmpeg -nostats -hide_banner -i /home/max/nas/media/music/albums/Mefjus/FabricLive 95_ Mefjus/01 Decypher.flac -map a:0 -filter ebur128=peak=true -f null -
replaygain: Mefjus & Kasra - FabricLive 95: Mefjus - Decypher feat. Kasra: gain -11.7 LU, peak 1.4791083881682074
Sending event: database_change
replaygain: applied track gain -11.7 LU, peak 1.4791083881682074 of FS
Sending event: write
Sending event: after_write
replaygain: done analyzing Mefjus & Kasra - FabricLive 95: Mefjus - Decypher feat. Kasra
Sending event: cli_exit
)
```

Led to this problem:

```
r128_album_gain: '0.0'
r128_track_gain: '0.0'
```

Here's a link to the music files that trigger the bug (if relevant):

### Setup

* OS:
* Python version: 3.12
* beets version: Latest
* Turning off plugins made problem go away (no):

My configuration (output of `beet config`) is:

```yaml
directory: /home/max/nas/media/music
library: /home/.config/beets/data/musiclibrary.db
#library: /home/nas/media/beets/data/musiclibrary.db
import:
none_rec_action: ask
copy: no
move: no
log: beetslog.txt
write: yes

match:
strong_rec_thresh: 0.20

paths:
default: $albumartist/$album/$track $title

art_filename: cover

plugins: lyrics fetchart info lastgenre edit replaygain embedart ftintitle zero importreplace duplicates scrub musicbrainz permissions beatport4

permissions:
file: 644
dir: 755

duplicates:
count: yes
format: $albumartist/$album/$track $title

musicbrainz:
host: musicbrainz.org
https: no
ratelimit: 1
ratelimit_interval: 1.0
searchlimit: 5
extra_tags: []
genres: no
external_ids:
discogs: no
bandcamp: no
spotify: no
deezer: no
beatport: no
tidal: no

beatport4:
art: yes
art_overwrite: no

lastgenre:
auto: true
force: yes
prefer_specific: true
separator: '; '
source: album
count: 4
min_weight: 15

deezer:
source_weight: 0.5

discogs:
data_source_mismatch_penalty: 0.5
append_style_genre: true
genre_separator: "; "
user_token: "redacted"

lyrics:
auto: yes
translate:
api_key:
from_languages: [en]
to_language:
dist_thresh: 0.11
fallback: null
force: no
print: no
sources: [lrclib, genius]
synced: yes

fetchart:
auto: yes
high_resolution: yes
sources:
- itunes
- coverart: release
- beatport
- coverart: release

replaygain:
auto: yes
backend: ffmpeg
overwrite: yes
r128_targetlevel: 89
r128: flac mp3
parallel_on_import: yes

ftintitle:
auto: yes
keep_in_artist: yes

edit:
albumfields: album albumartist genre artist artist_sort composer length
itemfields: track title artist artists artist_sort album genre composer length mb_artistid mb_artistids

embedart:
auto: yes
# compare_threshold: 10

zero:
auto: yes
fields:
# comments:
update_database: true

importreplace:
replacements:
- item_fields:
- albumartist
- albumartist_credit
- albumartist_sort
- artist
- artist_credit
- artist_sort
- artists
- artists_credit
- artists_ids
- artists_sort
- composer

album_fields:
- albumartist
- albumartist_credit
- albumartist_sort
- artist
- artist_credit
- artist_sort
- artists
- artists_credit
- artists_ids
- artists_sort
- composer

replace:
',': ';'
' b2b ': '; '
', ': ';'
```

Contributor guide

Open the contributing guide

Research direction

Start with the replaygain plugin's ffmpeg backend and reproduce the reported command using the configuration shown, focusing on how ebur128 output is parsed and stored for the r128 fields. Confirm the expected behavior for nonzero gain values and verify that the resulting tags no longer contain misleading 0.0 values.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
cli
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.