en:tcmediainfo:documentation:script_timingformat
TimingFormat
This function for counting and format timing values from the value in milliseconds.
TimingFormat(Format, Timing)
| Format | Timing format, can be constructed from any text with substitutes. The list of substitutes in table below. |
| Timing | Timing in milliseconds. |
| Rounding | Method for rounding to whole seconds (in the absence of millisecond substitutions): -1 — according to the TimingRounding option (default); 0 — to the previous whole value, as in MediaInfo; 1 — to the nearest whole value; 2 — to the next whole value. |
Return string formatted with given substitutions. If timing value can't be converted to numeric value, function return empty string.
Substitutions
| %h | hour, ex. 1 hour → 1 |
| %hh | hour with one leading zero, ex. 1 hour → 01 |
| %hhh | hour with two leading zeros, ex. 1 hour → 001 |
| %m | minutes, ex. 5 min → 5 |
| %mm | minutes with leading zero, ex. 5 min → 05 |
| %s | seconds, ex. 5 sec → 5 |
| %ss | seconds with leading zero, ex. 5 sec → 05 |
| %z | thouthand's fractions of second (= milliseconds), ex. 25 ms → 25 |
| %fff | thouthand's fractions of second (= milliseconds), with leading zeros, ex. 25 ms → 025 |
| %ff | fractions of milliseconds rounded to hundreds, with leading zeros, ex. 125 ms → 13 |
| %f | fractions of milliseconds rounded to ten's, ex. 125 ms → 1 |
Remarks
If no millisecond substitution is specified, it will be rounded to whole seconds according to the mathematical rule «to the nearest integer».
Example
TimingFormat('%hh:%mm%:%ss.%fff', 183353) → '00:03:03.353'
en/tcmediainfo/documentation/script_timingformat.txt · Последнее изменение: 2025/07/01 22:41 — loopback