Output file name template: Source file type?

Discussion of advanced MakeMKV functionality, expert mode, conversion profiles
Post Reply
timeshifter
Posts: 20
Joined: Wed Aug 01, 2018 7:13 pm

Output file name template: Source file type?

Post by timeshifter »

Hi,

I've been adjusting the output filename template in an effort to get reproducible filenames for a given disc. The title id used in the current default template can vary in response to changes in settings that change the track order (eg. track weight) or number of tracks (eg. minimum title length), so it's only consistent if the identical settings are used in subsequent rips.

I was pleased to see there is a template variable for source title number (SN), since the source title remains the same for a given track regardless of title order (as far as I can tell). Unfortunately, SN alone isn't sufficient to produce a unique filename. I have at least one bluray disc that has MPLS and M2TS source files with the same number, so a template using SN produces 2 files with the same name.

For example, on the Serenity Blu-ray there are several source files with the same number, like 00333.mpls and 00333.m2ts. Using the template "{NAME1}{-:CMNT1}{-:DT}{title:+DFLT}{-sourceid-:SN}", both titles map to the same filename: "Serenity-sourceid-00333.mkv".

I can make the filenames unique by adding title id to the template, but as mentioned above, this can vary so doesn't produce reproducible filenames across settings.

If there were an additional variable that returned the source file type this would be sufficient to produce reproducible and unique filenames in most cases I think. In the above example I could get something like "Serenity-sourceid-00333.mpls.mkv" and "Serenity-sourceid-00333.m2ts.mkv".

If possible, I'd like to request that the source file type be added as an output filename variable.

Thanks!
Master of Thyme and Spice
:D Registered User :D
timeshifter
Posts: 20
Joined: Wed Aug 01, 2018 7:13 pm

Re: Output file name template: Source file type?

Post by timeshifter »

Hmm. After playing around a bit with a few more discs and some DVDs as well, source file number + sourcefile type doesn't quite do the trick for producing a unique filename.

Perhaps I should re-frame the question as: what is the minimal set of attributes of a disc sufficient to create a reproducible unique filename for regardless of other MakeMKV settings, and could they be made available to the file name template variable list?

I guess the most straightforward might be a simple 'absolute title id' that is generated from counting all the titles on the disc before they are filtered by the settings to produce the 'relative' title id we currently have.
Master of Thyme and Spice
:D Registered User :D
Woodstock
Posts: 10315
Joined: Sun Jul 24, 2011 11:21 pm

Re: Output file name template: Source file type?

Post by Woodstock »

{_t:N2}

This will put "_t00" through "_t99" on the end of the file name, incrementing 1 for each file in the selection list. It's part of the default name template.
timeshifter
Posts: 20
Joined: Wed Aug 01, 2018 7:13 pm

Re: Output file name template: Source file type?

Post by timeshifter »

Thanks for the reply, Woodstock. I'm aware of that variable - that's the 'title id' and which I personally have come to refer to as 'relative title id'.

The problem with that variable is it is assigned by MakeMKV, changes depending on the settings and is not consistently reproducible for a given disc. Increasing or decreasing the minimum title length, for example, will change the id for a given track.

I'm trying to do what many people here in the 'Advanced MakeMKV usage' section are: develop a streamlined workflow to reduce the amount of time spent fiddling with the GUI and manually sifting through the useless titles on a disk to identify the desired ones. Once desired titles are identified once, I don't want repeat the manual process when retrieving something from that disc in the future. I'd rather capture that information in a file and automate extraction and processing through scripting.

The simplest way to do this with MakeMKV would be the option to generate a consistent and unique file name that is solely derived from information on the disc and doesn't change depending on MakeMKV settings. We couldn't do that before with the fixed filename, but the introduction of the output file template makes that a possibility if the necessary information is available through the template variables.

The more I think about it, the more I think that maybe the way to go is to just calculate a Unique ID for each title on the disc and make that available as a file name variable. Mediainfo does this for MKV files though I don't know what exactly it is basing it on.
Master of Thyme and Spice
:D Registered User :D
Woodstock
Posts: 10315
Joined: Sun Jul 24, 2011 11:21 pm

Re: Output file name template: Source file type?

Post by Woodstock »

You have control over the one thing that would change the "relative title number", and that's the minimum title length value. As long as it doesn't change, the title number won't change. Set it to zero, and all titles will be enumerated.
timeshifter
Posts: 20
Joined: Wed Aug 01, 2018 7:13 pm

Re: Output file name template: Source file type?

Post by timeshifter »

Yeah good point. It's a workaround that's far from ideal, but that would work in principle. Thank goodness makemkvcon has minimum title length as an option so you can pass in a value that's suitable for the disc in question. That can't be done with the GUI, so it's either edit the config file or open the settings dialog for a disc first to get the 'reproducible' title listing for a given disc, which can get tedious when the goal is to streamline a workflow.

It still bugs me from a developer's (and scientist's) perspective, since as workarounds go, it's arbitrary, unique to MakeMKV and thus not as robust as it could be.
Master of Thyme and Spice
:D Registered User :D
timeshifter
Posts: 20
Joined: Wed Aug 01, 2018 7:13 pm

Re: Output file name template: Source file type?

Post by timeshifter »

So after testing a bunch of DVDs and Blu-ray discs (with minimum title length=0), I've come to the following conclusion about source file number:

1. For DVDs it doesn't seem to provide much in the way of consistently useful information. Some DVDs have one title per source file, others can have multiple titles derived from a single source file (as many as 11 for one of the discs I tested). So source file id alone is not enough to generate a useful file name - title id is needed in addition. If you just want unique file names, title id alone is just as good for DVDs.

2. For Blu-ray discs it provides a bit more information, but the source file id alone without the file extension doesn't provide enough information to which source file the title is derived from, because M2TS and MPLS files can have the same number. Title id is needed to provide a unique file name as well. Without the full source file name (id+extension), this template variable seems pretty useless. Once again, title id alone is enough to generate a unique filename.

The addition of the extension (or just full sourcefile name) for Blu-rays might be enough to generate a meaningful file name for a title assuming that a title consistently maps to either a single M2TS or MPLS file. I haven't looked at enough disks to verify this is always true.

I look forward to future revisions of the output filename template, since this is a very useful enhancement, given that the primary output of MakeMKV (aside from full disk backups) are individual MKV files which typically require further manipulation and processing. One way to make this further processing amenable to portable tools is the ability to generate predictable filenames, which is what I had in mind here.
Master of Thyme and Spice
:D Registered User :D
Post Reply