6515 Commits

Author SHA1 Message Date
nanahi 675fb1229b input/dnd: move --drag-and-drop handling to dnd client
This unifies --drag-and-drop handling to a single place. All platforms
currently only support normal drop (mapped to "replace") and shift click
drop (mapped to "append").
2026-05-01 13:42:57 +02:00
nanahi 81611b4a4e input/dnd: move built-in drag and drop handling to mpv client
This moves the drag and drop handling to an internal mpv client,
removing the hardcoded handling from core.
2026-05-01 13:42:57 +02:00
nanahi 87ccb6022c command: add dropped-file property
This adds dropped-file property which contains a list of dropped files
and the type of the drop. This allows clients to implement custom drag
and drop handling.
2026-05-01 13:42:57 +02:00
nanahi e12ab84571 input: add --input-builtin-drag-and-drop option
This allows disabling the built-in drag and drop handler, while still
allowing VO to announce dropped files.
2026-05-01 13:42:57 +02:00
Kacper Michajłow c0c7584342 etc/builtin.conf: change gui mode to idle=yes
It is more expected from GUI application to stay open, even after
playback. Additionally this gives user a chance to inspect possible load
failures, while previously mpv would disappear.
2026-05-01 11:42:04 +02:00
Kacper Michajłow f5857d3b87 demux_lavf: support multiple program mappings per stream
Each stream can belong to multiple programs, we have to support that.
Previously track could belong only to single program.
2026-05-01 11:41:31 +02:00
Kacper Michajłow eedadc24ae player/command: hide dependent tracks
They are unusable on thier own, and shouldn't be selected by the user.
Those tracks are ment to be used internally.
2026-05-01 10:42:00 +02:00
Kacper Michajłow b4a7ea306e demux_{lavf,timeline}: add --flatten-editions
Lavf exposes programs/renditions as a flat track list tagged with
program_id. We respect this metadata and group tracks into their
respective programs, as tracks from different programs may be completely
unrelated to each other.

This commits adds an option to flatten the editions and ignore the
grouping.

Fixes: https://github.com/mpv-player/mpv/issues/17836#issuecomment-4345930205
2026-05-01 10:42:00 +02:00
kamperemu 8cc65c838e osc.lua: add box width option for box and slimbox layouts
osc.lua: add slimbox width option and preserve width values for box slimbox

docs: update default box and slimbox width values in OSC configuration

docs: add `boxwidth` and `slimboxwidth` script options to osc
2026-04-29 07:22:14 +02:00
Guido Cella ae3189567b select.lua: add select-secondary-subtitle-line
Requested in https://github.com/mpv-player/mpv/pull/17730#issuecomment-4321224996
2026-04-26 08:55:42 +02:00
Guido Cella 77ed8fef88 select.lua: use sub-lines instead of forking to ffmpeg
This:

- Removes the dependency of ffmpeg in PATH - useful on Windows, macOS
  (?), Flatpak.
- Will support subrandr.
- Avoids redownloading network subtitles.
- Avoids slow demuxing of large mkvs.
- But no longer returns future lines of embedded subtitles.
- No longer returns embedded lines of regions you seeked beyond without
  playing them.
- Changing sub track drops cached subtitles.
2026-04-25 19:58:52 +02:00
Guido Cella 5f02e1b8a2 sub: add sub-lines property
Return all subtitle lines in memory with text, start and end.

I did not name this sub-all so it cannot be misinterpreted as referring
to all subtitle tracks.

Closes #12810.
2026-04-25 19:58:52 +02:00
Guido Cella e046cd0736 context_menu.lua: add background_alpha script-opt
Closes #17807.
2026-04-24 20:19:50 +02:00
Julian Orth 4c9262664c wayland: implement session management
If the compositor supports session management, the mpv window is always
added to a session. The user can manage multiple sessions by using
`--wayland-session=<human-readable-name>`. Human-readable names are
mapped to session ids via files under `~/.local/state/mpv/sessions`. The
file name is computed as a hash of XDG_CURRENT_DESKTOP and the
human-readable name.

If multiple mpv instances are started with the same session name, the
latter mpv instance takes over the session.

Upon session restoration, the mpv window is restored by the compositor
according to its state from the previous session. What that entails is
compositor policy.
2026-04-24 15:36:44 +00:00
Guido Cella 35b851e38a DOCS/man/options: remove all_formats=yes warning
Dunno what wm4 was referring to here but all_formats=yes works just fine
and quickly for changing track at runtime. The only issue I see is that
it drops the video cache if you change audio track.
2026-04-21 22:50:12 +02:00
Guido Cella 6b524c4f0e ytdl_hook.lua: default to all_formats=yes
93fe7a5526 fixed the only problem with all_formats=yes, so make it the
default to allow changing tracks of ytdl_hook URLs at runtime without
re-invoking yt-dlp.

Closes #16872.
2026-04-21 22:50:12 +02:00
nanahi 531fe5a43e osc.lua: make window control buttons action customizable
Use bind_mouse_buttons helper. This makes it possible to bind custom
actions, such as right click X button to quit with watch later.
2026-04-21 18:19:18 +02:00
nanahi d9e8e0bdf6 osc.lua: add option to configure skip_forward/backward buttons
This adds _down_command support to bind_mouse_buttons so it can be
used to bind button down actions like mbtn_left_down, and let forward
and backward buttons use bind_mouse_buttons. This makes mouse button
down actions customizable.
2026-04-21 18:19:18 +02:00
NRK 7d1a598bdd vo_gpu: support parameters in RPN expressions 2026-04-20 21:52:06 +02:00
NRK d17e32fcfc DOCS/man/options: add missing RPN operators
equal and mod are also supported but were missing in the docs.
2026-04-20 21:52:06 +02:00
nanahi 891273055f DOCS/man/input: fix mouse-pos/hover documentation
The comment about video backends not updating pointer position is only
true if no mouse button is being pressed. If mouse button is pressed on
mpv window and then moves out of window region without releasing the
button, some platforms (win32, Wayland, X11) "capture" the pointer and
still report the coordinates, while some other platforms (SDL) do not.

The value of mouse-pos/hover also differs between platforms in this case.
The value is true on win32 and Wayland, but false on X11.

Fix documentation to address them.
2026-04-18 21:13:46 +02:00
Mike Will d0df98f701 command: allow metadata to be set manually 2026-04-18 05:37:38 +02:00
NRK 09d075f475 osc: define and add support for "preview" api
this adds a "standard" api for ui scripts and thumbnailers to
communicate with each other, based on the simple thumbfast api
[0].

the api works as follows:

* To issue a thumbnail draw command, the UI script will set the
  property `user-data/osc/draw-preview`.
* To clear the thumbnail, the UI script will set the previously
  mentioned property to `nil`.

a more ideal api would make it so that the thumbnailer script
only generates the thumbnail and doesn't need to draw at all.
but such api is vastly more complex [4] and would require a lot
more work and maintenance on mpv's side.

this is a decent enough api that allows arbitrary thumbnailers
and ui scripts to communicate between each other and work
together, while being simple enough that it can be supported
without too much maintenance.

this change has been tested with work with thumbfast [1]. and
for demonstration that this api can be useful outside of osc, it
has also been tested to work on mfpbar's thumbnailer branch [2].

the code to determine thumbnail x,y is based on the osc fork
inside of thumbfast [3].

[0]: https://github.com/po5/thumbfast?tab=readme-ov-file#for-ui-developers-how-to-add-thumbfast-support-to-your-script
[1]: https://github.com/po5/thumbfast/pull/173
[2]: https://codeberg.org/NRK/mpv-toolbox/src/branch/thumbnailer/mfpbar
[3]: https://github.com/po5/thumbfast/tree/vanilla-osc
[4]: https://github.com/mpv-player/mpv/discussions/17654
2026-04-17 20:36:48 +02:00
NRK 3e0729eb06 vo_gpu: add support for ENUM parameters 2026-04-17 20:03:22 +02:00
NRK a0b6233318 vo_gpu: add support for DEFINE parameters 2026-04-17 20:03:22 +02:00
NRK 0d655fe665 vo_gpu: initial support for tunable parameters
does not support everything supported by gpu-next/libplacebo,
only a subset that was needed to run some user shaders.
2026-04-17 20:03:22 +02:00
Guido Cella aec426a4d8 context_menu.lua: set user-data/mpv/context-menu/open
Closes #17428.
2026-04-17 19:46:12 +02:00
emberfade 179d832738 DOCS/man/vf: fix parameter separator in EBNF 2026-04-17 19:45:48 +02:00
nanahi 57490dd3a6 vo_gpu_next: add image-subs-hdr-peak=video-dynamic/video-static
Subtitles in general have constant brightness, but currently
--image-subs-hdr-peak=video uses detected peak value which is not synced
with scene and undesirable.

Add new modes that allow using static peak metadata or per-scene metadata.
2026-04-17 19:44:15 +02:00
nanahi 7f81e1ec8c vo_gpu_next: fix image subtitle hdr peak
704afb8968 assumed that HDR image
subtitles target SDR white. However, this is incorrect according to
UHD BD spec version 3.2:

> CLUTs of Presentation Graphics streams and Interactive Graphics streams
> are prepared by content author according to dynamic range property of
> the Primary video stream.
> If a Primary video stream is HDR, the Graphics streams have CLUTs
> expressed in BT.2020 color space primaries and ST2084 EOTF.
> If a Primary video stream is SDR, the Graphics streams have CLUTs
> expressed in BT.709 color space primaries and BT.1886 EOTF.

This means that PGS subtitles always have the same colorspace and HDR
dynamic range as the video, so the target peak should also be the same.

This is also supported by the BD-J spec (which displays PGS graphics):

> However the BD-ROM player does not support color space conversion nor
> dynamic range conversion of Java graphics and Background plane when
> mixing with video plane.

The Graphics model spec further states:

> The composited image on the graphics plane is transformed to full color
> and transparency by the CLUT module and then overlaid on the video
> image.

These sentences indicate that BD-ROM players simply overlay the decoded
graphics onto the video without any kind of conversion.

Change the default of image-subs-hdr-peak to 1000 to fix this.
This accommodates most HDR videos with a peak brightness of 1000 nits
and some bad HDR videos with 10000 nits peak brightness due to reencoding
and mixed with unmodified subtitles.
If there are compatibility issues, the option can be manually
set to sdr or video.

Fixes: 704afb8968
2026-04-17 19:44:15 +02:00
Kacper Michajłow 7ba2e1d713 osc.lua: reduce floatingalpha a little
Alpha blending is done in gamma light of the target, when the overlay is
drawn. Depending on VO and target format, the alpha value can act quite
differently.

Lower it a little to avoid excessive transparency in some cases. This
should be fixed or workaround in better way, but for now just adjust the
value.
2026-04-17 18:32:29 +02:00
Kacper Michajłow cc9610b850 demux_timeline: add support for programs 2026-04-17 18:30:43 +02:00
Kacper Michajłow 6c165fe46e demux_lavf: add support for programs
This adds proper support for MPEG-TS programs and HLS variants. Now
program selection is exposed as editions and tracks are grouped under
such edition. If there are external tracks added, they are available in
all editions.
2026-04-17 18:30:43 +02:00
nanahi a9e1ce9c0d DOCS/man/options: fix description for testing with all hwdec methods
The comment is not longer true since auto now means auto-safe.
Change to auto-unsafe which is the setting to use to test all methods.
2026-04-16 17:18:42 +02:00
NRK 1bfa18107c DOCS/man/input: add note on env case-sensitivity 2026-04-08 20:24:07 +02:00
NRK e2180e581e demux_playlist: only autocreate on regular file
trying to autocreate playlist when the file is a fifo breaks
playback. the bug report is a special case of `/dev/fd/*` but
even for named fifos, opening and closing them can cause the
other end to stop writing.

Closes: https://github.com/mpv-player/mpv/issues/17682
2026-04-06 18:50:28 +02:00
nanahi dbd31fd9d3 DOCS/man: use _name key for mp.command_native 2026-04-06 18:33:20 +02:00
nanahi 80582efca5 input/cmd: use _name for command name in mpv_command_node
Some commands have named arguments named "name", which conflict with
the "name" entry used to specify command name in mpv_command_node, so
they cannot be used with mpv_command_node.

These commands include:
set, del, change-list, add, cycle, multiply, enable-section,
disable-section, define-section, script-binding, keybind, keypress,
keydown, keyup, apply-profile.

This makes mpv_command_node accept command name as key "_name", so
"name" can be used to specify command arguments. For compatibility,
if "_name" entry does not exist, then "name" is used as fallback.
2026-04-06 18:33:20 +02:00
nanahi b7377ede18 DOCS/man/options: document @ syntax for --input-ipc-server 2026-04-06 18:31:27 +02:00
nanahi c2d9905598 DOCS/man/options: add note about %tX behavior change 2026-04-06 18:30:10 +02:00
Guido Cella c961c96afb lua: remove the deprecated error field from end-file
This has been deprecated for 6 years so remove the compatibility code.

This basically reverts 37f441d61b.
2026-04-01 22:10:08 +00:00
Guido Cella 70b8b22c8b command: remove the deprecated time-start property
This has been deprecated for 11 years since 70df1608d6 so remove it. All
it does is return 0.
2026-04-01 22:09:25 +00:00
zenodity ae2384bce0 player/command: add default-value/choices arg fields to command-list
Add optional 'default-value' and 'choices' fields where appropriate
for command arguments in the 'command-list' property. Update
documentation to reflect the command-list schema change.

DOCS/interface-changes/command-list: add changes
2026-04-01 16:08:26 +02:00
NRK d79c4ad1e3 player/command: add env property
mainly so that env vars can be accessed from within config files.
2026-03-31 18:44:10 +00:00
NRK 5f45db9d70 DOCS/man/input: document dummy properties
these properties cannot be used directly and require a
sub-property. document this explicitly.
2026-03-31 18:44:10 +00:00
Guido Cella 9465b30a40 DOCS: remove behavior changes before version 0.38
These are ancient and not useful anymore.

The version notices are kept under:
overlay-add: handled by #17520
end-file's file_error: the notice should be removed when updating error
field like suggested there
time-start: this should just be removed
~/.mpv/: needed to understand why this is used
--aid: needed to understand the following paragraphs
2026-03-30 15:09:38 +00:00
Dudemanguy 90985bb826 vo: officially deprecate vo_vaapi
Using vo_vaapi has already been heavily discouraged for years since
years since 5c313f1f59. More importantly,
it's just fundamentally broken on most hardware, serves no real purpose,
and well we shouldn't just ship broken stuff. vo_vaapi largely only ever
worked correctly on some intel hardware. The VO relies on certain API
calls that other vendors never implemented so things like the OSD and
subtitles are just never going to work. This largely has no reason to
exist either. If you're looking for efficient playback, you can use
vo_gpu/vo_gpu_next in dumb mode with vaapi decoding. You can also use
vo_dmabuf_wayland with vaapi as well to avoid even more GPU to CPU
copies and theoretically be even more efficient.
2026-03-30 00:34:31 +00:00
llyyr b824aec50f wayland: document that wayland-edge-pixels-touch only affects CSD 2026-03-30 00:32:51 +00:00
llyyr 51ef7c5960 wayland: use wayland-edge-pixels-pointer for tablet input resize zone
Tablet input is more similar to mouse input than it is to touch input,
so it makes sens to use wayland-edge-pixels-pointer instead. Also
document that it's used for tablet input, previously this was completely
undocumented.
2026-03-30 00:32:51 +00:00
Martin Tournoij 86b30afea0 DOCS/man/options: clarify --directory-filter-types docs
Using "mpv --directory-filter-types= dir" as an "empty" value doesn't
work, because that will create a list where the first value is an empty
string, so get_directory_filter() returns AUTO_NONE instead of AUTO_ANY.

You need to use --directory-filter-types-clr instead, to create a proper
empty list.

I suppose this is kind of obvious in hindsight, but it took me quite
some time and digging through the mpv source to figure this out –
initially I assumed it must be a bug of some sort.

So clarify what "empty list" means.
2026-03-30 00:13:03 +00:00