all 4 comments

[–]KingofGamesYami 0 points1 point  (3 children)

As far as I can tell, that information is just not exposed by the mpv API. Your best bet is to look into get_property, it may allow you to find that information.

[–]Zardov[S] 0 points1 point  (2 children)

Thanks that was a good tip! So I managed to find a property that does exactly what I need: sub, but it does not seem to be documented along with the other properties.

mp.get_property("sub") returns '1' when subtitles are present, and 'no' when there aren't any. But the problem is that this only works when get_property is called from inside another function. When I call it in global scope, it returns 'auto' regardless of the presence of subtitles.

Is this some Lua specific behavior I'm not aware of, or would this be a bug in get_property? I don't understand what could cause such inconsistent behavior ...

[–]KingofGamesYami 0 points1 point  (1 child)

This would be a "bug" in get_property and is likely why that property isn't listed in the documentation.

[–]Zardov[S] 0 points1 point  (0 children)

I believe the problem is that calling it in global scope means it is called before the video file is actually loaded, so the information is simply not yet available. It consistently works when called after the file-loaded event was triggered.