beets icon indicating copy to clipboard operation
beets copied to clipboard

Beets replaygain with ffmpeg writing 0 values

Open Th3K1ngP1n opened this issue 1 month ago • 2 comments

Problem

Running this command in verbose (-vv) mode:

$ 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:

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 ': '; '
        ', ': ';'

Th3K1ngP1n avatar Nov 20 '25 10:11 Th3K1ngP1n

What output do you get if you run the ffmpeg command that replaygain runs?

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 -

jackwilsdon avatar Nov 27 '25 21:11 jackwilsdon

I found out that it's actually the edit plugin that will write empty rg_ tags to the files when opening --all fields, as we can see:

  genre: Drum & Bass -> Drum & Bass; Electronic
  rg_album_gain: 0.0 -> 0.0
  rg_album_peak: 0.0 -> 0.0
  r128_album_gain: 0.0 -> 0.0

Th3K1ngP1n avatar Nov 28 '25 08:11 Th3K1ngP1n