I'm using ffplay to play an audio file in a bash script and I need to maximize volume. I've found 2 independent commands that address some part of a chain affecting the volume:

This gets me about halfway there:

pactl set-sink-volume alsa_output.pci-0000_00_14.2.analog-stereo 200%

Adding options like this -af "volume=1250" to the ffplay command string didn't make any perceptible difference.

Nor did pacmd set-source-volume I 65536 with I being 0, 1, or 2.

I need the equivalent of the 2nd slider in the playback tab in the pavucontrol, just above the arrow in this picture:

Of course it would be nice if there was one command to max out volume and I didn't have to stack them, but maybe that doesn't exist. But surely this slider has a scriptable equivalent.


2 Answers 2


I understand your question to be "how do I set the equivalent of the application stream volume slider in the 'Playback' tab of pavucontrol".

The total volume depends on both the application stream volume and the sink volume, and the latter should in general stay constant at 100% (or whatever value is needed to max out the soundcard amplifiers controlled by ALSA).

Have a look at pacmd list-sink-inputs. That will show all currently playing streams. Use this to find the index of the stream you want to control. A reduced output like from pacmd list-sink-inputs | egrep '(index)|(name)' is easier to read or parse if there are many streams.

Once you find the index, use

pactl set-sink-input-volume index_you_found '100%'

to set the volume to 100%. This also works with pacmd, but only with raw values and not with absolute or relative percentages, so I prefer pactl. (Don't ask me why there are two different tools ...).

Guessing indices won't work. Using set-source-volume won't work, because that sets the volume of the audio inputs.

You can't set the volume of a stream of it's not playing. With the default Pulseaudio setup on most distros, stream volumes will be saved for each application (using the application name), and restored the next time when the application is started. So unless you use different application names, you'll have to set the volume only once (and you can also do that directly in pavucontrol).

  • Except for a typo (it's "pacmd list-sink-inputs", no s on the end of sink), that's perfect. Hard to edit in the comment field, so I'll elaborate a bit in an "answer", but this is the right answer. Feb 9, 2017 at 2:01
  • Typo fixed. BTW, I do appreciate upvotes. :-)
    – dirkt
    Feb 9, 2017 at 6:33
  • @dirkt OP has less than 15 rep, so he can't use upvote, but I will do it instead
    – Alex
    Feb 9, 2017 at 7:00
  • 1
    OP has more rep now. So 'e made good on the debt.:-) Jun 30, 2017 at 6:55

"I understand your question to be "how do I set the equivalent of the application stream volume slider in the 'Playback' tab of pavucontrol". "

Yes. That's the nub. The rest is context in case the question is based on erroneous assumptions or someone wants to suggest a better way.

"Have a look at pacmd list-sinks-inputs."

"Unknown command" But a little poking around in Snynaptic and I find that's part of pulseaudio-utils which I have, and a little more poking around and I tried this: pacmd list-sink-inputs Looked right. Furthermore: pacmd list-sink-inputs | grep index just returned one line, so, must BE right. Then, as instructed: pactl set-sink-input-volume 1 '100%' Oh my. That's LOUD.

Interesting that it comes up with a different index every time I start ffplayer, even if it is the only audio stream playing, so I'll have to grep and do a little string manipulation to put that in my script, but that shouldn't be any problem.

Thanks, Dirkt.

BTW, I don't know where I got the impression that the command:

pactl set-sink-volume alsa_output.pci-0000_00_14.2.analog-stereo 200%

maxed out at 200%. It goes higher. Although they tell me it can damage speakers if you push it. I assume the idea is that if you don't set this over 100% you can safely push

pactl set-sink-input-volume I 'N%'

(which also does not max out at a 100)

as high as you want, which doesn't make a heck of a lot of sense to me, so maybe it isn't true. Anyway, I now have 2 ways to wake the dead and wear out my speakers.

  • Every running application gets an index, and you can run e.g. ffmpeg multiple times, so there's no way to assign always the same index to a particular application. It's just like process ids in the kernel: Every time you start a new process, you get a new PID.
    – dirkt
    Feb 9, 2017 at 6:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.