Page 1 of 1

Replay Gain

PostPosted: Sun Nov 05, 2017 12:50 am
by ScorpionStingz
Is it even possible to stream and normalize volume? My vorbis files all contain replay gain tags but I don't think they are being read. If at all possible this seems like a reasonable request.

Re: Replay Gain

PostPosted: Fri Dec 15, 2017 3:33 pm
by lonesomerider
I used transcoding with ffmpeg to achieve this:

Album repleaygain:
convert from: mp3 flac ogg oga aac m4a wav wma aif aiff ape mpc shn
convert to: flac
STEP 1: ffmpeg -loglevel panic -nostats -i %s -map 0:0 -af volume=replaygain=album -f flac -

ffmpeg params depend on the version of ffmpeg you have

the drawback is that you lose skipping inside the track.

Re: Replay Gain

PostPosted: Wed Feb 21, 2018 3:53 pm
by dest41
Transcoding for replaygain seems overkill. That metadata should be given to the online player, so that volume is adjusted accordingly. That would change the communication protocol though.

Re: Replay Gain

PostPosted: Wed Feb 21, 2018 3:54 pm
by dest41
And taking replay gain into account is a very useful feature IMHO.

Re: Replay Gain

PostPosted: Sun Mar 11, 2018 1:23 pm
by lonesomerider
I agree that it should be part of the player.

But I have the specific issue that I uses Sonos and sonos only supports replaygain "magically" on flac files and ignores it on mp3.
I decided to have separate players with separate logins to switch between album replaygain and track replaygain. Like this I am able to listen to albums with the right loudness for the different tracks and switch to track gain on random play.
Maybe an overkill, but I am a control freak regarding my listening preferences.

using apps like dsub makes this configuration obsolete, but then again they usually only implement track gain or album gain, but not both, which annoys me either on concept albums or on random play, especially when listening with headphones.

I am already too long old style on this matter that I do not wait any more for the new savior to promise me musical heaven. I want my musical paradise now and here. And under my control ;-).

Re: Replay Gain

PostPosted: Sun Mar 11, 2018 1:42 pm
by lonesomerider
I just realised i did not update the settings i use now (removing the tags to prevent double replaygain being applied):

Album and Track gain to flac:
Code: Select all
ffmpeg -loglevel panic -nostats -i %s -map 0:0 -af volume=replaygain=album -metadata REPLAYGAIN_TRACK_GAIN= -metadata REPLAYGAIN_ALBUM_GAIN= -metadata REPLAYGAIN_TRACK_PEAK= -metadata REPLAYGAIN_ALBUM_PEAK= -f flac -
ffmpeg -loglevel panic -nostats -i %s -map 0:0 -af volume=replaygain=track -metadata REPLAYGAIN_TRACK_GAIN= -metadata REPLAYGAIN_ALBUM_GAIN= -metadata REPLAYGAIN_TRACK_PEAK= -metadata REPLAYGAIN_ALBUM_PEAK= -f flac -


Same to mp3:
Code: Select all
ffmpeg -loglevel panic -nostats -i %s -map 0:0 -af volume=replaygain=album -metadata REPLAYGAIN_TRACK_GAIN= -metadata REPLAYGAIN_ALBUM_GAIN= -metadata REPLAYGAIN_TRACK_PEAK= -metadata REPLAYGAIN_ALBUM_PEAK= -b:a %bk -v 0 -f mp3 -
ffmpeg -loglevel panic -nostats -i %s -map 0:0 -af volume=replaygain=track -metadata REPLAYGAIN_TRACK_GAIN= -metadata REPLAYGAIN_ALBUM_GAIN= -metadata REPLAYGAIN_TRACK_PEAK= -metadata REPLAYGAIN_ALBUM_PEAK= -b:a %bk -v 0 -f mp3 -


And for downsampling to mp3:
Code: Select all
ffmpeg -loglevel panic -nostats -i %s -map 0:0 -b:a %bk -v 0 -f mp3 -


Explanation of the parameters:
Code: Select all
-loglevel panic -nostats
reduce log size to errors only.
Code: Select all
-metadata REPLAYGAIN_TRACK_GAIN= -metadata REPLAYGAIN_ALBUM_GAIN= -metadata REPLAYGAIN_TRACK_PEAK= -metadata REPLAYGAIN_ALBUM_PEAK=
remove replay gain information

The rest are the standard parameters as used by subsonic as default, except the
Code: Select all
-v 0
, which forces best dynamic encoding on mp3

Re: Replay Gain

PostPosted: Sat Mar 24, 2018 10:26 pm
by apastuszak
AVsub on the iPhone and DSub on Android both support ReplayGain. The Gain tags are sent to the client app. Up to the app if it uses them.