My goal is to have mplayer start at one volume, then change to a different volume in a scripted fashion.

My current script (pseudo code - simplicity)

mkfifo mplayer_fifo
(sleep 5m; echo "set_property volume 80" > "mplayer_fifo")&
mplayer -volume 100 -slave -input file="mplayer_fifo" song1 song2 song3

The above starts mplayer at volume 100 then changes to volume 80 after 5 minutes.

The issue however is it only changes to volume 80 for the current song then reverts back to 100 on the next song. I desire that it change to 80 and stay there.

Is this possible?

  • It might indicate that mplayer spawns itself while playing multiple files, just a guess — check mplayer PID between songs to be sure. What about dropping the -volume 100 argument? mplayer will always start at full volume anyway. If that doesn't work, B plan might be to set the application volume through pulseaudio.
    – user86969
    Commented Mar 3, 2015 at 8:55
  • PID was a interesting idea - but mplayer does keep the same PID. I removed the -volume and the volume stayed at the adjusted level. I appears that the -volume resets the volume per song and not just initially.
    – Miati
    Commented Mar 3, 2015 at 17:43

1 Answer 1


-volume adjusts the volume on a per song basis (it appears)

This is a close workaround

mkfifo mplayer_fifo
(sleep 5s; echo "set_property volume 100" > "mplayer_fifo" \
sleep 5m; echo "set_property volume 80" > "mplayer_fifo")&

mplayer -slave -input file="mplayer_fifo" song1 song2 song3

It sets the volume to 100 after 5 sec (letting mplayer start) then changes to 80 after the 5min. I imagine this would not work very well if you wanted it to start quiet as it'll blast for a moment before going quiet.

  • Isn't mplayer supposed to start with volume set to 100 by default, as per the man pages? I'm wondering if the -5s step and -volume 100 are really necessary.
    – user86969
    Commented Mar 3, 2015 at 18:03
  • Possibly and I should of made this more clear that this is pseudo code. I intend to use this with parameters lower then this. With some testing, it appears that mplayer will play at whatever the current volume level is (per alsa or pulseaudio, etc). So if it's low, it will play low. However setting the volume with -volume seems to adjust those.
    – Miati
    Commented Mar 3, 2015 at 18:26
  • Argh! Distraction when you hold me! I was rather thinking about sleep 5s; echo "set_property volume 100" yet typed -volume 100 but I think you got me right.
    – user86969
    Commented Mar 3, 2015 at 22:02

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .