Skip to content

player/command: deprecate ao-volume and ao-mute#17704

Open
llyyr wants to merge 1 commit intompv-player:masterfrom
llyyr:deprecate-ao-properties
Open

player/command: deprecate ao-volume and ao-mute#17704
llyyr wants to merge 1 commit intompv-player:masterfrom
llyyr:deprecate-ao-properties

Conversation

@llyyr
Copy link
Copy Markdown
Contributor

@llyyr llyyr commented Apr 5, 2026

These properties were mostly only useful before the removal of --softvol=no. At present, mpv has its own volume mixer and never touches the audio server volume at all. There's no reason for mpv to provide these properties, if users wish to change the audio server volume, it's trivial to do so in a Lua/Javascript script.

Moreover, ao-volume presents the audio server volume as-is, meaning without any conversion or normalization. As such, the meaning of the value changes depending on the audio server in use or the configuration of the audio server. There's no correct way for mpv to do this normalization. This kind of functionality is better suited for a Lua/Javascript script where the user can normalize the values to their preferred scale, and not bloat mpv with pointless properties that are confusing and not useful.

@llyyr llyyr marked this pull request as ready for review April 5, 2026 04:12
These properties were mostly only useful before the removal of
--softvol=no. At present, mpv has its own volume mixer and never touches
the audio server volume at all. There's no reason for mpv to provide
these properties, if users wish to change the audio server volume, it's
trivial to do so in a Lua/Javascript script.

Moreover, ao-volume presents the audio server volume as-is, meaning
without any conversion or normalization. As such, the meaning of the
value changes depending on the audio server in use or the configuration
of the audio server. There's no correct way for mpv to do this
normalization. This kind of functionality is better suited for
a Lua/Javascript script where the user can normalize the values to their
preferred scale, and not bloat mpv with pointless properties that are
confusing and not useful.
@winex
Copy link
Copy Markdown

winex commented Apr 5, 2026

oh, now i see your point!
but i'm against this. it's very useful for me!

  • use --ao=pipewire (or --ao=pulse)
  • run 4 mpv instances and control soft-volume
  • no mixer-app is able to show levels of mpv internals

instead:

  • change controls to ao-volume, ao-mute
  • ...and voila! your every instance is shown in EVERY mixer ever made to support pipewire or pulse

p.s. deprecate pulse instead - it's so laggy ;p
pipewire is just superior to ... even JACK (for consumer usage)

@DanOscarsson
Copy link
Copy Markdown
Contributor

I never use mpv internal soft volume.
For me the requirement for a user friendly volume handling is:

  • Volume is remembered between mpv instances. By that I mean that when I start mpv again it will use the last volume I used last time.
  • Remembered volume can be different for "music" and for "video".'

Changing volume using GUI volume controls for application volume should also be able to control mpv volume.

This works fine with pulse. I have not tested with pipewire

@kasper93
Copy link
Copy Markdown
Member

kasper93 commented Apr 5, 2026

I'm against this, this property is quintessential towards making mpvOS. Some users may prefer ao-volume instead of softvol of mpv mixer.

@winex
Copy link
Copy Markdown

winex commented Apr 5, 2026

@llyyr are we talking about the same thing at all? do you copy that under PA and PW it's NOT the system volume anymore (unless ALSA), but per-process/audio-stream volume?

tests

$ mpv $OPTS_AO --input-commands='set ao-volume 30' test.wav
and for OPTS_AO:

  • --ao=pipewire: process/stream volume
  • --ao=pulse: process/stream volume
  • --ao=alsa: ALSA default output/node volume, probably sound card in legacy configuration
    (i'm using loopback module as default to attenuate by mumble a single node, but not all apps)

and "your soundcard works perfectly!" © ... moreso, ao-mute mutes either stream or ALSA output and it's nice being able to choose what exactly you want

p.s. #17703 reverting cubic scale for pipewire applied
p.p.s. i'm still under debian's pipewire-alsa hacks, but my setup is too complex to try switching back to plain ALSA

as expected

so, i suppose this IS what everyone EXPECTS and probably matches the docs! 😆

@sfan5
Copy link
Copy Markdown
Member

sfan5 commented Apr 5, 2026

There's no reason for mpv to provide these properties, if users wish to change the audio server volume, it's trivial to do so in a Lua/Javascript script.

This is a bad argument. It's trivial to do a lot of things if you shell out to some helper tool (e.g. clipboard), yet many things are very useful to have inside mpv.

@orion1vi
Copy link
Copy Markdown
Contributor

orion1vi commented Apr 5, 2026

on macos these offer zero latency volume changes, while internal volume, speed, etc have non trivial latency bound by audio buffer size. should not be removed.

@llyyr
Copy link
Copy Markdown
Contributor Author

llyyr commented Apr 5, 2026

Volume is remembered between mpv instances. By that I mean that when I start mpv again it will use the last volume I used last time.

This can be done with watch later

Remembered volume can be different for "music" and for "video".'

This can be done with auto profiles and watch later as well

Changing volume using GUI volume controls for application volume should also be able to control mpv volume.

This is an argument against reverting softvol=no removal, not against this PR. This PR is just doing what wm4 would've wanted.

This is a bad argument. It's trivial to do a lot of things if you shell out to some helper tool (e.g. clipboard), yet many things are very useful to have inside mpv.

The reason we added clipboard to mpv was because there was a proposed internal user for it, that being writing images directly to clipboard. There are no internal users for ao-volume or ao-mute. People also wish mpv could directly change their display modeset, but we don't have in mpv core do we? A script is a perfect match for this use case, and I don't mind writing one myself and maintaining it in the TOOLS subdir if it would help push this forward.

I could say the same thing you did to argue in favor of including any and everything in mpv core. In fact, "thing should be a script because it's easier to maintain" was the main argument thrown around against having #15845. Which one is it?

on macos these offer zero latency volume changes, while internal volume, speed, etc have non trivial latency bound by audio buffer size. should not be removed.

Default buffer shouldn't be so huge that it has non trivial perceivable latency, --audio-buffer is only 200ms and can likely be smaller without issues.

@na-na-hi
Copy link
Copy Markdown
Contributor

na-na-hi commented Apr 5, 2026

Default buffer shouldn't be so huge that it has non trivial perceivable latency, --audio-buffer is only 200ms and can likely be smaller without issues.

This is not possible for avfoundation: #11955 (comment)

And the purposed solution by the feature author is to use ao-volume/ao-mute:
#15014 (comment)
iina/iina#5064 (comment)

@llyyr
Copy link
Copy Markdown
Contributor Author

llyyr commented Apr 5, 2026

purposed solution

The feature author states that it is merely a "simple workaround". The proposed solution is the stalled PR #14058

@na-na-hi
Copy link
Copy Markdown
Contributor

na-na-hi commented Apr 5, 2026

The feature author states that it is merely a "simple workaround". The proposed solution is the stalled PR #14058

It is a solution if you want underruns. It was explained in #11955 (comment) and also in #15014 (comment)

AVSampleBufferAudioRenderer needs such a large preroll otherwise it will starve.

Setting it to a lower value can make the AO reacts quicker; though lower value may lead to underruns.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants