mpv-player / mpv-player/mpv

ReplayGain isn't re-calculated when changing item in playlist with gapless playback enabled

Open
#8,267 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

core:audio os:linux
Dominant language
C
Stars
37k
Forks
3.5k
Avg merge
1d 10h
Merged PRs (30d)
22

Description

Provide following Information:

  • mpv version: 0.32.0-810-gf85de9e6d6
  • Linux Distribution: Arch
  • Source of the mpv binary: mpv-full-build AUR package

When playing multiple files in a playlist, it seems like the first file's replaygain is applied to everything, instead of the replaygain for each file being applied when that file is played.

For example, file 1:

mpv -v --no-config --replaygain=track ./1.mkv 2>&1 | grep -i replay
[cplayer] Command line options: '-v' '--no-config' '--replaygain=track' './1.mkv'
[cplayer] Setting option 'replaygain' = 'track' (flags = 8)
[cplayer] Replaygain: Track=5.330000/0.314455 Album=5.330000/0.314455
[cplayer] Applying replay-gain: 1.847141

file 2:

mpv -v --no-config --replaygain=track ./2.mkv 2>&1 | grep -i replay
[cplayer] Command line options: '-v' '--no-config' '--replaygain=track' './2.mkv'
[cplayer] Setting option 'replaygain' = 'track' (flags = 8)
[cplayer] Replaygain: Track=-4.150000/0.647406 Album=-4.150000/0.647406
[cplayer] Applying replay-gain: 0.620155

But if I play both and manually do playlist-next, the only output is:

mpv -v --no-config --replaygain=track ./1.mkv ./2.mkv 2>&1 | grep -i replay
[cplayer] Command line options: '-v' '--no-config' '--replaygain=track' './1.mkv' './2.mkv'
[cplayer] Setting option 'replaygain' = 'track' (flags = 8)
[cplayer] Replaygain: Track=5.330000/0.314455 Album=5.330000/0.314455
[cplayer] Applying replay-gain: 1.847141

and the second file is too loud.

Full log
https://0x0.st/i5zk.txt

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the issue with the provided mpv commands and compare the replaygain output for standalone files versus playlist-next. Trace where replaygain state is updated when changing playlist items; done means each file applies its own track gain during gapless playback, with tests or logs confirming the second file is no longer too loud.

Written by the indexing model from the issue text.

Assessment

Tech stack
c
Domain
audio-video-rtc
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.