Mpv: How to convert this to lua script?

Created on 12 Jan 2017  路  4Comments  路  Source: mpv-player/mpv

mpv version and platform

mpv 0.23.0 (C) 2000-2016 mpv/MPlayer/mplayer2 projects
 built on Tue Jan 10 07:34:20 UTC 2017
ffmpeg library versions:
   libavutil       55.43.100
   libavcodec      57.71.100
   libavformat     57.62.100
   libswscale      4.3.101
   libavfilter     6.68.100
   libswresample   2.4.100
ffmpeg version: 3.2.git

The lua scripting in the manual is so complicated, is there an easier way to achieve what I'm going to do below?

Example:

if (height>1080)
   vo=opengl
else if ((height>720) && (fps=23.976))
   vo=opengl
   profile=opengl-hq
   cscale=lanczos
   video-sync=display-resample
   interpolation
else if (height>720)
   vo=opengl
   profile=opengl-hq
   cscale=lanczos
   video-sync=display-resample
   script-opts=autospeed-xrandr=true,autospeed-osd=true,autospeed-spause=2,autospeed-estfps=true
else if ((height>540) && (fps=23.976))
   vo=opengl
   profile=opengl-hq
   video-sync=display-resample
   interpolation
else if (height>540)
   vo=opengl
   profile=opengl-hq
   video-sync=display-resample
   script-opts=autospeed-xrandr=true,autospeed-osd=true,autospeed-spause=2,autospeed-estfps=true
else if (fps=23.976)
   vo=opengl
   profile=opengl-hq
   opengl-shaders=path  
   video-sync=display-resample
   interpolation
else
   vo=opengl
   profile=opengl-hq
   opengl-shaders=path  
   video-sync=display-resample
   script-opts=autospeed-xrandr=true,autospeed-osd=true,autospeed-spause=2,autospeed-estfps=true

Most helpful comment

@garoto Thanks, you solved my problem.

All 4 comments

No matter I type profile-desc=cond:p.container-fps<24 or profile-desc=cond:get("container-fps", 0)<24, it just doesn't work.

How to do the "if" "else" "&&" "or" with this script???

From what I gather, dashes must be replaced with underscores. It's explained in this part of the comment section:

[...]If the variable name contains any "_"
characters, they are turned into "-". For example, "playback_time" would
return the property "playback-time". (Although you can also just write
p["playback-time"].)

So profile-desc=cond:p.container_fps<24

@garoto Thanks, you solved my problem.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ghost picture ghost  路  3Comments

sant527 picture sant527  路  4Comments

ww7 picture ww7  路  3Comments

532910 picture 532910  路  3Comments

fitipe picture fitipe  路  3Comments