Moonbase59 / loudgain

ReplayGain 2.0 loudness normalizer based on the EBU R128/ITU BS.1770 standard (-18 LUFS, FLAC, Ogg, MP2, MP3, MP4, M4A, AAC, ALAC, Opus, ASF, WMA, WAV, AIFF, WavPack, APE)
Other
182 stars 23 forks source link

loudgain refuses to write tags to this MP3 file #57

Open dbedrenko opened 1 year ago

dbedrenko commented 1 year ago

Actually, I have a few albums for which loudgain successfully calculates the gain, but then it just doesn't write the MP3 tags to the file despite me passing the option -s i.

Here is one such MP3. I run loudgain on it which returns with a successful exit code:

$ loudgain -I 3 -S -L -k -s i '01(51) Allegro (1).mp3'
[✔] Scanning '01(51) Allegro (1).mp3' ...
[✔] Container: WAV / WAVE (Waveform Audio) [wav]
[✔] Stream #0: MP3 (MPEG audio layer 3), 44100 Hz, 2 ch, stereo
 100% [===============================================================================================================================]

Track: 01(51) Allegro (1).mp3
 Loudness:   -17.63 LUFS
 Range:       10.71 dB
 Peak:     0.635784 (-3.93 dBTP)
 Gain:        -0.37 dB

Yet no tags are written and the file's modified time hasn't changed either:

$ ffprobe 01\(51\)\ Allegro\ \(1\).mp3
[...]
Input #0, wav, from '01(51) Allegro (1).mp3':
  Metadata:
    album           : Koncert ¹1, îð. 8
    artist          : Antonio Vivaldi
    genre           : koncert
    title           : 51. Koncert ¹1, îð. 8. Allegro
    track           : 1
    comment         : Orkestr "I Musici", Roberto Michelucci, skripka
    date            : 1963
  Duration: 00:02:57.00, bitrate: 127 kb/s
  Stream #0:0: Audio: mp3 (U[0][0][0] / 0x0055), 44100 Hz, stereo, fltp, 128 kb/s

Anyone know what's going on?

copart commented 4 months ago

I ran loudgain over my entire library and also noticed that it was unable to update a few mp3 files.

The command I used is: /usr/bin/loudgain -a -k -s e *.mp3

I also rewrote the tags using Kid3 to try to fix anything that could be corrupted in the metadata.

Further debug, the mp3 files were most likely corrupt.

I fixed by doing sometime like: ffmpeg -i "source.mp3" -acodec copy "fixed.mp3"