Skip to main content

Variable substitution

In various sections of this manual, variable substitution is mentioned. Wherever mentioned, the following variables can be used and will be replaced with their corresponding text equivalents:

  • $stream - inserts the whole stream name including wildcard portion (blank if non-applicable)

  • $basename - inserts only the stream name without wildcard portion (blank if non-applicable)

  • $wildcard - inserts only the wildcard portion of the stream name (blank if non-applicable)

  • $pluswildcard - inserts only the wildcard portion of the stream name, including the plus symbol (blank if non-applicable)

  • $source - inserts the whole configured source (blank if non-applicable)

  • $day --- The current day of the month (range 01 to 31, server time).

  • $month --- The current month (range 01 to 12, server time).

  • $year --- The current year (numerical, 4 digits, server time).

  • $hour --- The current hour (range 00 to 23, server time).

  • $minute --- The current minute (range 00 to 59, server time).

  • $second --- The current second (range 00 to 60, server time).

  • $wday - inserts the number of the current day of the week (range 1 to 7, Monday being 1, server time)

  • $yday - inserts the number of the current day of the year (range 001 to 366, server time)

  • $week - inserts the number of the current week of the year (range 01 to 53, server time)

  • $datetime - inserts $year.$month.$day.$hour.$minute.$second

  • $epoch - Inserts current time in epoch format (seconds)

  • $utc - Inserts current UTC time

  • $rand8 - Inserts 8 random characters

  • $rand16 - Inserts 16 random characters

Segmented outputs

In the context of writing segments to disk the following variables are also available, in addition to the above.

  • $segmentCounter - Inserts the number equal to how many segments have been created for this stream so far.

  • $currentMediaTime - Inserts the first media time stamp of the segment.

Custom variables

Custom variables are variables you can create yourself and will only apply to your MistServer instance once set up. These variables can be created at the General panel and can be split up in 2 types:

  • Static variables - These variables will serve as a replacement and do not change. These are often used to write hard to remember information like long paths or logins easier. It has a 63 character limit.

  • Dynamic variables - These variables will run a command to determine the variable and can change depending on the script used. They are more flexible in use and could be used to trigger events within MistServer should you use them. It has a 511 character limit. You can also set how often the script should be run and when it should time-out.