Skip to content
This repository has been archived by the owner on Sep 16, 2023. It is now read-only.

Support showing mpv statistics and possibly key binding via scripts #29

Open
John-He-928 opened this issue Jan 26, 2022 · 5 comments
Open
Labels
enhancement New feature or request

Comments

@John-He-928
Copy link

This is actually a bug in official IINA that not (fully) fixed I think. The official issue: iina#1053

The mpv-stats.lua script is not able to add key bindings to IINA, so the statistics feature in mpv is somewhat unusable. IINA official gives a workaround that add key bindings manually to switch pages. I don't think this is a perfect solution. Also, the page 2 of the statistics, frame timing, don't shown up even with a key binding. The frame timing page is very useful when debugging video filters or custom shader scripts.

What you want IINA to do:

  • Support showing frame timing statistics page.
  • Support key bindings from scripts, if possible.

What IINA does currently:

When switching to frame timing page, it shows no contents.

Why you think this should be added:

The frame timing page is very useful when debugging video filters or custom shader scripts.

Examples of other projects that have something similar:
The mpv official manual page: https://mpv.io/manual/master/#stats

@CarterLi
Copy link
Owner

Is there any runtime flags for showing mpv statistics?

@CarterLi
Copy link
Owner

CarterLi commented Jan 26, 2022

possibly key binding via scripts

Afraid no. IINA uses MPV as a player core (engine) but dont use MPV's UI part. Key binding is completely about UI, keyboard events, etc.

@John-He-928
Copy link
Author

@CarterLi mpv statistics is enabled by key action script-binding stats/display-stats-toggle, which default to I in mpv.

The official IINA do support showing statistics when assigning a key to script-binding stats/display-stats-toggle, script-binding show-page-1, script-binding show-page-2, ... However, frame timing page(script-binding show-page-2), the most important page I think, is empty when shown. IINA closed the issue long ago, with this left unfixed.

Frame timing page looks like this in mpv:
frame timing

@John-He-928
Copy link
Author

I dug a bit into the stats.lua script.

The script queries properties from mpv periodically via mp.get_property() interface, formats them into ASS subtitle script text and prints them using mp.set_osd_ass(). Different pages shows different sets of properties.

The reason that the frame timing page is empty, is IINA lacks some required properties.

local function append_perfdata(s, dedicated_page)
    local vo_p = mp.get_property_native("vo-passes")
    print("vo_p = ", vo_p)
    if not vo_p then
        return
    end

vo_p here is nil so the following routines are skipped.

If IINA can provide the vo-passes property as mpv does, the frame timing page show be available.

@low-batt
Copy link
Collaborator

low-batt commented Feb 1, 2022

There are multiple issues here. Since the Lua stats script is now built into mpv, IINA probably should add the two key bindings that are active by default to the "mpv Default" key bindings. From mpv manual / STATS:

The following key bindings are active by default unless something else is already bound to them:

i Show stats for a fixed duration
I Toggle stats (shown until toggled again)

Not sure how IINA could support the dynamic activation of key bindings the stats script supports.

Note that the mpv command to display a particular page is not "show-page-<number>" according to the mpv documentation:

And to display a certain page directly:

i script-binding stats/display-page-1
e script-binding stats/display-page-2

By adding key bindings I was able to display pages 1 and 3. I expect page 2 is blank due to this issue iina#3281

On the vo-passes property the mpv manual / Property list says:

vo-passes

Contains introspection about the VO's active render passes and their execution times. Not implemented by all VOs.

I looked through the mpv client API and didn't spot any discussion of statistics. Would have to dig deeply into mpv code to see if there is a way for IINA to supply these statistics to work.

@CarterLi CarterLi added the enhancement New feature or request label Feb 9, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants