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?
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– user869692015年03月03日 18:03:04 +00:00Commented 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– Miati2015年03月03日 18:26:15 +00:00Commented 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– user869692015年03月03日 22:02:40 +00:00Commented Mar 3, 2015 at 22:02
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.