owntone/owntone-server

Replaygain doesn't appear to be working in owntone 28.9

boblund opened this issue · 4 comments

I have two M4A (alac codec) files - call them loud and soft. When played in owntone 28.9 (raspberry pi debian bookworm) loud is considerably louder than soft. When using decode_audio_filters = { 'loudnorm=I=-16:LRA=11:TP=-1.5' }, as suggested in owntone.conf, loud and soft are approximately the same volume.

Loudgain was used to add replaygain track gain to loud and soft. When using decode_audio_filters = { 'volume=replaygain=track' }, as suggested in owntone.conf, there is no apparent change in the respective volumes.

Below are the relevant results of ffprobe for loud and soft.

loud

  Metadata:
    REPLAYGAIN_TRACK_GAIN: -0.97 dB
    REPLAYGAIN_TRACK_PEAK: 0.885371

  Stream #0:0[0x2](und): Audio: alac (alac / 0x63616C61), 44100 Hz, stereo, s16p, 667 kb/s (default)
    Metadata:
    Side data:
      replaygain: track gain - -0.970000, track peak - 0.000021, album gain - unknown, album peak - unknown, 

    "streams": [
        {
            "side_data_list": [
                {
                    "side_data_type": "Replay Gain"
                }

and soft

Metadata:
    REPLAYGAIN_TRACK_GAIN: 3.91 dB
    REPLAYGAIN_TRACK_PEAK: 0.568308

  Stream #0:0[0x2](und): Audio: alac (alac / 0x63616C61), 44100 Hz, stereo, s16p, 636 kb/s (default)
    Metadata:
    Side data:
      replaygain: track gain - 3.910000, track peak - 0.000013, album gain - unknown, album peak - unknown, 

    "streams": [
        {
            "index": 0,
            "side_data_list": [
                {
                    "side_data_type": "Replay Gain"
                }

Thanks for reporting. Can you send the two tracks to me at espenjurgensen@gmail.com? It will make it easier to test both this issue (and issue #1787).

I've tried converting the files to wav with ffmpeg -i source.mpga -filter:a volume=replaygain=track out.wav, and these output files also don't seem to be volume adjusted. So two questions:

  • Have you found a way of getting ffmpeg to decode where the output is volume adjusted (without using loadnorm, of course)? If I can't make ffmpeg do it then I won't be able to make OwnTone do it.
  • Have you found a tool for checking file volume level? Just listening to the music isn't always practical for me, so some Linux tool would be nice.

I ran the following (Mac, ffmpeg version 3.3.2):

ffmpeg -i file-rg.m4a  -filter:a volume=replaygain=track out.wav

Below are Mac Audacity screenshots showing the amplitude differences (link to Audacity on linux).

file-rg.m4a (replaygain metadata added with loudgain)
image

out.wav
image

So, it appears ffmpeg is adjusting the volume.

I have now tested with ffmpeg 6.1 and 7.0.1, and I couldn't reproduce the issue. I piped the output to files and compared the levels with the config setting on and off, and Audacity shows that volume was indeed adjusted. I also notice that with the log on debug level it says: "[DEBUG] ffmpeg: Using gain 3.910000 dB from replaygain side data.".

It was difficult to hear any change, but maybe 3.91 just isn't much? Perhaps you can try testing with a file where have you have set it very high, just to be sure that you can hear a difference.