Skip to content

ReplayGain does not work with .flac and .m4a files.

Description

I have added the ReplayGain tag to my .flac and .m4a files.

ReplayGain worked with these files in VLC for Windows and Linux.

However, ReplayGain did not work in VLC for Android, even though the files are the same.

Expected behavior

ReplayGain works with .flac and .m4a files as well as .mp3 files.

Actual behavior

ReplayGain does not work with .flac and .m4a files.

Steps to reproduce

  1. Prepare test sound files.

    I used Owner-R128-RG.flac to create test sound files.

    First, create a file with the volume turned down. As the volume has been changed, remove the ReplayGain tag once.

    Next, convert from this file to some file formats.

    ffmpeg -i Owner-R128-RG.flac -map_metadata -1 -af volume=-20dB Owner_soft_volume.flac
    ffmpeg -i Owner_soft_volume.flac Owner_soft_volume.m4a
    ffmpeg -i Owner_soft_volume.flac Owner_soft_volume.mp3
    ffmpeg -i Owner_soft_volume.flac Owner_soft_volume.ogg
    ffmpeg -i Owner_soft_volume.flac Owner_soft_volume.opus

    Similarly, create files with the volume turned up.

    ffmpeg -i Owner-R128-RG.flac -map_metadata -1 -af volume=5dB Owner_loud_volume.flac
    ffmpeg -i Owner_loud_volume.flac Owner_loud_volume.m4a
    ffmpeg -i Owner_loud_volume.flac Owner_loud_volume.mp3
    ffmpeg -i Owner_loud_volume.flac Owner_loud_volume.ogg
    ffmpeg -i Owner_loud_volume.flac Owner_loud_volume.opus
  2. Add the ReplayGain tag.

    Copy the files from 1. and rename them to Owner-RG2_soft_volume.* and Owner-RG2_loud_volume.*.

    I used rsgain to add the ReplayGain tag.

    rsgain custom -s i Owner-RG2_soft_volume.flac
    ...
    rsgain custom -s i Owner-RG2_soft_volume.opus
    rsgain custom -s i Owner-RG2_loud_volume.flac
    ...
    rsgain custom -s i Owner-RG2_loud_volume.opus
  3. Play the files on each device.

    First, set the ReplayGain settings in VLC as shown in the table below. Set the "Default replay gain" to 0.0 to make it easier to see if ReplayGain works.

    Setting items Value
    Enable replay gain
    Replay gain mode Album
    Replay preamp 0.0
    Default replay gain 0.0
    Peak protection

    Next, listen to and compare the file with the volume turned down and the file with the ReplayGain tag added to it.

    If ReplayGain works, the file with that tag will be louder.

    Windows Linux My smartphone Android emulator
    Owner-RG2_soft_volume.flac louder louder no change no change
    Owner-RG2_soft_volume.m4a louder louder no change no change
    Owner-RG2_soft_volume.mp3 louder louder louder louder
    Owner-RG2_soft_volume.ogg louder louder louder louder
    Owner-RG2_soft_volume.opus louder louder louder louder

    Similarly, compare files with the volume turned up.

    If ReplayGain works, the file with that tag will be softer.

    (Please note that the sound is loud.)

    Windows Linux My smartphone Android emulator
    Owner-RG2_loud_volume.flac softer softer no change no change
    Owner-RG2_loud_volume.m4a softer softer no change no change
    Owner-RG2_loud_volume.mp3 softer softer softer softer
    Owner-RG2_loud_volume.ogg softer softer softer softer
    Owner-RG2_loud_volume.opus softer softer softer softer

    These results show that in VLC for Android, ReplayGain works with .mp3 files, etc., but not with .flac and .m4a files.

ffprobe output

PS C:\test_sound> ffprobe -version
ffprobe version 6.0-essentials_build-www.gyan.dev Copyright (c) 2007-2023 the FFmpeg developers
built with gcc 12.2.0 (Rev10, Built by MSYS2 project)
configuration: --enable-gpl --enable-version3 --enable-static --disable-w32threads --disable-autodetect --enable-fontconfig --enable-iconv --enable-gnutls --enable-libxml2 --enable-gmp --enable-lzma --enable-zlib --enable-libsrt --enable-libssh --enable-libzmq --enable-avisynth --enable-sdl2 --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxvid --enable-libaom --enable-libopenjpeg --enable-libvpx --enable-libass --enable-libfreetype --enable-libfribidi --enable-libvidstab --enable-libvmaf --enable-libzimg --enable-amf --enable-cuda-llvm --enable-cuvid --enable-ffnvcodec --enable-nvdec --enable-nvenc --enable-d3d11va --enable-dxva2 --enable-libmfx --enable-libgme --enable-libopenmpt --enable-libopencore-amrwb --enable-libmp3lame --enable-libtheora --enable-libvo-amrwbenc --enable-libgsm --enable-libopencore-amrnb --enable-libopus --enable-libspeex --enable-libvorbis --enable-librubberband
libavutil      58.  2.100 / 58.  2.100
libavcodec     60.  3.100 / 60.  3.100
libavformat    60.  3.100 / 60.  3.100
libavdevice    60.  1.100 / 60.  1.100
libavfilter     9.  3.100 /  9.  3.100
libswscale      7.  1.100 /  7.  1.100
libswresample   4. 10.100 /  4. 10.100
libpostproc    57.  1.100 / 57.  1.100

PS C:\test_sound> ffprobe -hide_banner Owner_soft_volume.flac
Input #0, flac, from 'Owner_soft_volume.flac':
  Metadata:
    encoder         : Lavf60.3.100
  Duration: 00:00:29.32, start: 0.000000, bitrate: 1279 kb/s
  Stream #0:0: Audio: flac, 44100 Hz, stereo, s32 (24 bit)
PS C:\test_sound> ffprobe -hide_banner Owner_soft_volume.m4a
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'Owner_soft_volume.m4a':
  Metadata:
    major_brand     : M4A
    minor_version   : 512
    compatible_brands: M4A isomiso2
    encoder         : Lavf60.3.100
  Duration: 00:00:29.32, start: 0.000000, bitrate: 134 kb/s
  Stream #0:0[0x1](und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 132 kb/s (default)
    Metadata:
      handler_name    : SoundHandler
      vendor_id       : [0][0][0][0]
PS C:\test_sound> ffprobe -hide_banner Owner_soft_volume.mp3
Input #0, mp3, from 'Owner_soft_volume.mp3':
  Metadata:
    encoder         : Lavf60.3.100
  Duration: 00:00:29.36, start: 0.025057, bitrate: 128 kb/s
  Stream #0:0: Audio: mp3, 44100 Hz, stereo, fltp, 128 kb/s
    Metadata:
      encoder         : Lavc60.3.
PS C:\test_sound> ffprobe -hide_banner Owner_soft_volume.ogg
Input #0, ogg, from 'Owner_soft_volume.ogg':
  Duration: 00:00:29.32, start: 0.000000, bitrate: 106 kb/s
  Stream #0:0: Audio: vorbis, 44100 Hz, stereo, fltp, 112 kb/s
    Metadata:
      encoder         : Lavc60.3.100 libvorbis
PS C:\test_sound> ffprobe -hide_banner Owner_soft_volume.opus
Input #0, ogg, from 'Owner_soft_volume.opus':
  Duration: 00:00:29.32, start: 0.000000, bitrate: 94 kb/s
  Stream #0:0: Audio: opus, 48000 Hz, stereo, fltp
    Metadata:
      encoder         : Lavc60.3.100 libopus

PS C:\test_sound> ffprobe -hide_banner Owner-RG2_soft_volume.flac
Input #0, flac, from 'Owner-RG2_soft_volume.flac':
  Metadata:
    ENCODER         : Lavf60.3.100
    REPLAYGAIN_TRACK_GAIN: 15.36 dB
    REPLAYGAIN_TRACK_PEAK: 0.098846
  Duration: 00:00:29.32, start: 0.000000, bitrate: 1279 kb/s
  Stream #0:0: Audio: flac, 44100 Hz, stereo, s32 (24 bit)
    Side data:
      replaygain: track gain - 15.360000, track peak - 0.000002, album gain - unknown, album peak - unknown,
PS C:\test_sound> ffprobe -hide_banner Owner-RG2_soft_volume.m4a
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'Owner-RG2_soft_volume.m4a':
  Metadata:
    major_brand     : M4A
    minor_version   : 512
    compatible_brands: M4A isomiso2
    REPLAYGAIN_TRACK_GAIN: 15.56 dB
    REPLAYGAIN_TRACK_PEAK: 0.114441
    encoder         : Lavf60.3.100
  Duration: 00:00:29.32, start: 0.000000, bitrate: 134 kb/s
  Stream #0:0[0x1](und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 132 kb/s (default)
    Metadata:
      handler_name    : SoundHandler
      vendor_id       : [0][0][0][0]
    Side data:
      replaygain: track gain - 15.560000, track peak - 0.000003, album gain - unknown, album peak - unknown,
PS C:\test_sound> ffprobe -hide_banner Owner-RG2_soft_volume.mp3
Input #0, mp3, from 'Owner-RG2_soft_volume.mp3':
  Metadata:
    encoder         : Lavf60.3.100
    REPLAYGAIN_TRACK_GAIN: 15.85 dB
    REPLAYGAIN_TRACK_PEAK: 0.110046
  Duration: 00:00:29.36, start: 0.025057, bitrate: 128 kb/s
  Stream #0:0: Audio: mp3, 44100 Hz, stereo, fltp, 128 kb/s
    Metadata:
      encoder         : Lavc60.3.
    Side data:
      replaygain: track gain - 15.850000, track peak - 0.000003, album gain - unknown, album peak - unknown,
PS C:\test_sound> ffprobe -hide_banner Owner-RG2_soft_volume.ogg
Input #0, ogg, from 'Owner-RG2_soft_volume.ogg':
  Duration: 00:00:29.32, start: 0.000000, bitrate: 106 kb/s
  Stream #0:0: Audio: vorbis, 44100 Hz, stereo, fltp, 112 kb/s
    Metadata:
      ENCODER         : Lavc60.3.100 libvorbis
      REPLAYGAIN_TRACK_GAIN: 15.51 dB
      REPLAYGAIN_TRACK_PEAK: 0.114075
    Side data:
      replaygain: track gain - 15.510000, track peak - 0.000003, album gain - unknown, album peak - unknown,
PS C:\test_sound> ffprobe -hide_banner Owner-RG2_soft_volume.opus
Input #0, ogg, from 'Owner-RG2_soft_volume.opus':
  Duration: 00:00:29.32, start: 0.000000, bitrate: 94 kb/s
  Stream #0:0: Audio: opus, 48000 Hz, stereo, fltp
    Metadata:
      ENCODER         : Lavc60.3.100 libopus
      REPLAYGAIN_TRACK_GAIN: 15.36 dB
      REPLAYGAIN_TRACK_PEAK: 0.123566

PS C:\test_sound> ffprobe -hide_banner Owner_loud_volume.flac
Input #0, flac, from 'Owner_loud_volume.flac':
  Metadata:
    encoder         : Lavf60.3.100
  Duration: 00:00:29.32, start: 0.000000, bitrate: 1641 kb/s
  Stream #0:0: Audio: flac, 44100 Hz, stereo, s32 (24 bit)
PS C:\test_sound> ffprobe -hide_banner Owner_loud_volume.m4a
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'Owner_loud_volume.m4a':
  Metadata:
    major_brand     : M4A
    minor_version   : 512
    compatible_brands: M4A isomiso2
    encoder         : Lavf60.3.100
  Duration: 00:00:29.32, start: 0.000000, bitrate: 134 kb/s
  Stream #0:0[0x1](und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 132 kb/s (default)
    Metadata:
      handler_name    : SoundHandler
      vendor_id       : [0][0][0][0]
PS C:\test_sound> ffprobe -hide_banner Owner_loud_volume.mp3
Input #0, mp3, from 'Owner_loud_volume.mp3':
  Metadata:
    encoder         : Lavf60.3.100
  Duration: 00:00:29.36, start: 0.025057, bitrate: 128 kb/s
  Stream #0:0: Audio: mp3, 44100 Hz, stereo, fltp, 128 kb/s
    Metadata:
      encoder         : Lavc60.3.
PS C:\test_sound> ffprobe -hide_banner Owner_loud_volume.ogg
Input #0, ogg, from 'Owner_loud_volume.ogg':
  Duration: 00:00:29.32, start: 0.000000, bitrate: 113 kb/s
  Stream #0:0: Audio: vorbis, 44100 Hz, stereo, fltp, 112 kb/s
    Metadata:
      encoder         : Lavc60.3.100 libvorbis
PS C:\test_sound> ffprobe -hide_banner Owner_loud_volume.opus
Input #0, ogg, from 'Owner_loud_volume.opus':
  Duration: 00:00:29.32, start: 0.000000, bitrate: 95 kb/s
  Stream #0:0: Audio: opus, 48000 Hz, stereo, fltp
    Metadata:
      encoder         : Lavc60.3.100 libopus

PS C:\test_sound> ffprobe -hide_banner Owner-RG2_loud_volume.flac
Input #0, flac, from 'Owner-RG2_loud_volume.flac':
  Metadata:
    ENCODER         : Lavf60.3.100
    REPLAYGAIN_TRACK_GAIN: -9.37 dB
    REPLAYGAIN_TRACK_PEAK: 1.000000
  Duration: 00:00:29.32, start: 0.000000, bitrate: 1641 kb/s
  Stream #0:0: Audio: flac, 44100 Hz, stereo, s32 (24 bit)
    Side data:
      replaygain: track gain - -9.370000, track peak - 0.000023, album gain - unknown, album peak - unknown,
PS C:\test_sound> ffprobe -hide_banner Owner-RG2_loud_volume.m4a
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'Owner-RG2_loud_volume.m4a':
  Metadata:
    major_brand     : M4A
    minor_version   : 512
    compatible_brands: M4A isomiso2
    REPLAYGAIN_TRACK_GAIN: -8.98 dB
    REPLAYGAIN_TRACK_PEAK: 1.000000
    encoder         : Lavf60.3.100
  Duration: 00:00:29.32, start: 0.000000, bitrate: 134 kb/s
  Stream #0:0[0x1](und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 132 kb/s (default)
    Metadata:
      handler_name    : SoundHandler
      vendor_id       : [0][0][0][0]
    Side data:
      replaygain: track gain - -8.980000, track peak - 0.000023, album gain - unknown, album peak - unknown,
PS C:\test_sound> ffprobe -hide_banner Owner-RG2_loud_volume.mp3
Input #0, mp3, from 'Owner-RG2_loud_volume.mp3':
  Metadata:
    encoder         : Lavf60.3.100
    REPLAYGAIN_TRACK_GAIN: -8.88 dB
    REPLAYGAIN_TRACK_PEAK: 1.000000
  Duration: 00:00:29.36, start: 0.025057, bitrate: 128 kb/s
  Stream #0:0: Audio: mp3, 44100 Hz, stereo, fltp, 128 kb/s
    Metadata:
      encoder         : Lavc60.3.
    Side data:
      replaygain: track gain - -8.880000, track peak - 0.000023, album gain - unknown, album peak - unknown,
PS C:\test_sound> ffprobe -hide_banner Owner-RG2_loud_volume.ogg
Input #0, ogg, from 'Owner-RG2_loud_volume.ogg':
  Duration: 00:00:29.32, start: 0.000000, bitrate: 114 kb/s
  Stream #0:0: Audio: vorbis, 44100 Hz, stereo, fltp, 112 kb/s
    Metadata:
      ENCODER         : Lavc60.3.100 libvorbis
      REPLAYGAIN_TRACK_GAIN: -9.18 dB
      REPLAYGAIN_TRACK_PEAK: 1.000000
    Side data:
      replaygain: track gain - -9.180000, track peak - 0.000023, album gain - unknown, album peak - unknown,
PS C:\test_sound> ffprobe -hide_banner Owner-RG2_loud_volume.opus
Input #0, ogg, from 'Owner-RG2_loud_volume.opus':
  Duration: 00:00:29.32, start: 0.000000, bitrate: 95 kb/s
  Stream #0:0: Audio: opus, 48000 Hz, stereo, fltp
    Metadata:
      ENCODER         : Lavc60.3.100 libopus
      REPLAYGAIN_TRACK_GAIN: -9.31 dB
      REPLAYGAIN_TRACK_PEAK: 1.000000

Screenshot / video

Context

App version

3.5.4

Android version

10

Device model

SO-52A

App mode

Smartphone

Other devices

Windows Linux Android emulator
OS Windows 10 fedora 36 Android 7.1.1
App version 3.0.18 (x86_64) 3.0.18 (x86_64) 3.5.4 (x86)

I used the Android emulator that comes with Android Studio.

Edited by s520