Default output file name template

Discussion of advanced MakeMKV functionality, expert mode, conversion profiles
Post Reply
mike admin
Posts: 3519
Joined: Wed Nov 26, 2008 2:26 am

Default output file name template

Post by mike admin » Thu Nov 08, 2018 1:31 pm

Starting with 1.14.0 the default output file name is generated using a template string set in preferences. The template syntax is described below with default value being

Code: Select all

The template is a string with optional substitution variables enclosed in curly braces like {NAME}. For each title MakeMKV would expand the variables and assign the produced file name. If the produced file ends up being unique, that would be the file name you'll get. If your template would produce the same name for different titles, MakeMKV would still add _txx suffix. So it is highly recommended to use one of the variables to generate unique file name. The default template always generates unique file names.

There are 3 important attributes each title may (or may not) have, that define the value of substitution variables:
Name - this is the title name that usually comes from disc metadata, or the value assigned in GUI.
Comment - the comment string for title that comes from disc metadata. Cannot be changed in GUI, usually present on blu-ray discs with fake playlists.
DateTime - the date and time when the title was recorded. Always present on AVCHD discs, almost always present on BDAV discs.
These attributes define the values and presence of some substitution variables.

Each variable can be either defined - meaning it has some value, or not defined - meaning the value of the variable is unknown. The syntax of each substitution variable is {[Prefix:][+|-]Name} . If the variable is defined, then its value is put into output file name along with prefix (if specified). If the variable is not defined, then nothing is added to the file name at all, variable is ignored. For example variable {T3} is defined to a 3-digit title id for all titles except title 0. So the substitution {_t:T3} would produce text "_t001" for title #1, "_t002" for title #2, but would produce nothing for title #0.

All variables that hold the numeric value can have an optional suffix that specifies how many digits to use. For example the variable {AN} is always defined and holds the value of title id. One can use the {AN} directly or specify number of digits manually - {AN1} {AN2} etc. The default precision is variable-specific. For example, the variable {SN} holds the source title id if it is present. For blu-ray that would be id of mpls or clpi file, and for DVD that would be original title number as encoded in IFO. So value of {SN} on blu-ray could be "00000" and on DVD "00". But the value of variable {SN2} would be "00" in both cases.

The last syntax element - there is a way to test whether a variable is defined or not by putting a "+" or "-" before its name. The variable {+SomeName} is expanded to empty string if the variable {SomeName} is defined, and is not defined if {SomeName} is not defined as well. The "-" works in opposite way, producing empty string if variable is not defined. This can be used to output characters conditionally by using a prefix feature. For example the token {something:-DT} would output "something" if {DT} variable is not defined (title has no date/time meta info) and wold output nothing if {DT} is defined.

Below is the list of all variables.

Title Name:
{NAME0} - Name with cleansing level 0. This is minimal prepossessing - only characters absolutely forbidden if file names are replaced.
{NAME1} - Name with cleansing level 1. In addition to level 0 some problematic characters are replaced to underscores.
{NAME2} - Name with cleansing level 2. In addition to level 1 all spaces are replaced to underscores and all problematic characters are replaced with underscores as well.
{NAME} - alias to {NAME0}

Title Comment:
{CMNT} {CMNT0} {CMNT1} {CMNT2} - Title comment with the same cleansing rules as for {NAME}

Title Date/Time:
{DT} - Date/time string as "yyyy-mm-dd hh:mm:ss"
{DY} - year
{DM} - month
{DD} - day
{TH} - hour
{TM} - minute
{TS} - second

Title id (as assigned by MakeMKV):
Next 3 variables are defined only if {DT} is NOT defined, i.e. if the title has no recording date/time information
{N} - title id starting from zero
{M} - title id starting from one
{T} - title id, same as {N} but defined for all titles except title #0

{AN} {AM} {AT} - same as {N} {M} {T}, but are always defined, regardless if recording date/time information is present or not.

{SN} - source title number, as encoded on disc. For DVD it is the DVD title number. For Blu-ray it is MPLS id if title comes from MPLS or CLPI id if title comes from CLPI.

{DFLT} - a special variable. This variable is defined only if nothing was added to the output file name buffer so far. So the token {something:+DFLT} would produce "something" only if the file name is still an empty string - meaning all variables before were expanded to nothing.


If name is present, it is added with cleansing level 1, if comment is present then "-" is added following the comment cleansed with level 1, if recording date/time is present then "-" is added following "yyyy-mm-dd hh:mm:ss" string. If nothing was added so far (no name, comment or date/time) then the "title" string is added. Then the "_txx" suffix is added, where xx is a two-digit title id.
This is the default template.

{NAME}{tilte:+DFLT}{_t:T2} - Name with cleansing level 0 is added, if name is not defined then the string "title" is added instead. For title #0 nothing is added, for the rest the "_txx" would be added where xx is a two-digit title id.

{NAME1}{title:-NAME}{-:SN} - Name will be added, if name is not present then string "title" will be added, following by source title id (DVD id or MPLS id) if present.

Also, please note that the "default output file name template" is a "live" settings value. That means that you can open the disc, go to preferences, change the template, and MakeMKV would re-assign default names using the new template for the already-opened disc. This is the easiest way to play with this setting.

Posts: 4
Joined: Wed Jul 23, 2014 2:51 am

Re: Default output file name template

Post by scottstone » Tue Jan 22, 2019 12:16 am

Am i just missing something? I don't see the template. ver. 1.14.2.

Posts: 5861
Joined: Sun Jul 24, 2011 11:21 pm

Re: Default output file name template

Post by Woodstock » Tue Jan 22, 2019 2:29 am

Do you have Expert mode turned on? Preferences->General, make sure Expert mode is checked.

Then the Advanced tab will be available, and the template is the third text entry box.
How to aid in finding the answer to your problem:

Posts: 4
Joined: Wed Jul 23, 2014 2:51 am

Re: Default output file name template

Post by scottstone » Tue Jan 22, 2019 3:58 am

Who knew! Thanks.

Post Reply