View Single Post
Old 8th April 2009, 19:16   #3  |  Link
madshi
Registered Developer
 
Join Date: Sep 2006
Posts: 9,140
How to configure profile rules:

The madVR settings profiling logic is very flexible, but also requires a bit of scripting for best effect. Script language is pretty easy. Basically scripting is expected to be a string of "if", "else if" and "else" statements. Every "if" (or "else if") statement contains of one or more value comparisons and selects one profile to be activated. Each value comparison must be placed in brackets. By using the logical operations "and" or "or" you can check multiple values to create more complex decisions.

Let's look at an example. The following script selects one of 4 profiles, depending on the source dimensions and the frame rate after deinterlacing. I think the script is pretty much self explaining:
Code:
if      (srcWidth <= 1050) and (srcHeight <= 768) and (deintFps < 31) "SD 24fps"
else if (srcWidth <= 1050) and (srcHeight <= 768)                     "SD 60fps"
else if                                               (deintFps < 31) "HD 24fps"
else                                                                  "HD 60fps"
Supported keywords and operators:
Code:
if/else statements:     "if", "else if", "elseif", "elsif", "else"
logical operators:      "and", "or", "&&", "||"
equal check:            "==", "="
unequal check:          "!=", "<>", "#"
bigger/smaller check:   "<", ">", "<=", ">="
boolean "not" operator: "not", "!"
Supported numerical values:
Code:
srcWidth, srcHeight                              src width/height (cropping according to settings)
croppedSrcWidth, croppedSrcHeight                cropped   src width/height
uncroppedSrcWidth, uncroppedSrcHeight            uncropped src width/height
AR, uncroppedAR, encodedAR                       cropped AR (aspect ratio), uncropped AR, encoded AR, 
targetWidth, targetHeight                        width/height after scaling (cropping according to settings)
croppedTargetWidth, croppedTargetHeight          width/height after scaling cropped   source
uncroppedTargetWidth, uncroppedTargetHeight      width/height after scaling uncropped source
scalingFactor.x/y                                overall scaling factor
fps, deintFps, bitDepth                          source frame rate, framerate after deinterlacing, bitdepth
displayMode.x/y, refreshRate                     display mode information
runtime                                          movie runtime (in minutes)
hdrVideoPeak                                     video peak luminance (in Nits) -> maxCLL (if valid) or SMPTE 2086
Supported boolean values:
Code:
4:2:0, 4:2:2, 4:4:4, RGB     which pixel format does the source have?
HDR                          is the video HDR?
srcInterlaced                is the source interlaced?
filmMode                     is film mode (IVTC) active?
MPEG2, VC-1, h264            which codec is the source encoded in?
exclusive, overlay, windowed rendering mode
fullscreen                   is playback borderless fullscreen (can be windowed or exclusive)
AMD, nVidia, Intel           which GPU manufacturer are we rendering on?
smoothMotion                 is smooth motion FRC active?
variableAR                   does this video have variable ARs?
hdr                          is the video HDR?
battery                      is this a laptop running on battery?
Supported string values:
Code:
mediaPlayer                   media player exe file name
filePath, fileName, fileExt   e.g. "c:\movie.mkv", "movie.mkv", "mkv", wildcards supported
display                       name of the active display device
One more example to show how to use numerical, boolean and string values:
Code:
if ((not 4:2:0) or (AR = 16:9)) and (fileName = "*horribleSubs*.mkv") "Weird profile" else "Normal profile"

Last edited by madshi; 19th September 2018 at 13:28.
madshi is offline   Reply With Quote