Changing default track selection

Discussion of advanced MakeMKV functionality, expert mode, conversion profiles
Locked
mike admin
Posts: 3407
Joined: Wed Nov 26, 2008 2:26 am
Contact:

Changing default track selection

Post by mike admin » Sat Dec 24, 2011 8:44 am

Starting with MakeMKV 1.7.0 , default track selection logic may be overridden in conversion profile. For information about conversion profile please see this post - http://www.makemkv.com/forum2/viewtopic.php?f=10&t=4385 . Default selection logic is a property of particular track setting. For example, the relevant part of "default" profile reads

Code: Select all

    <!-- Default rule - copy as is -->
    <trackSettings input="default">
        <output outputSettingsName="copy" 
                defaultSelection="-sel:all,+sel:(favlang|nolang),-sel:(havemulti|havecore),=100:all,-10:favlang">
        </output>
    </trackSettings>
    <!-- Save LPCM mono or stereo as raw LPCM -->
    <trackSettings input="LPCM-stereo">
        <output outputSettingsName="lpcm"
                defaultSelection="-sel:all,+sel:(favlang|nolang),-sel:(havemulti|havecore),=100:all,-10:favlang">
        </output>
    </trackSettings>
    <!-- Put multi-channel LPCM into WAVEX container-->
    <trackSettings input="LPCM-multi">
        <output outputSettingsName="wavex"
                defaultSelection="-sel:all,+sel:(favlang|nolang),-sel:(havemulti|havecore),=100:all,-10:favlang">
        </output>
    </trackSettings>
UPDATE: Starting with version 1.7.3 default selection string may be overridden in MakeMKV preferences on Advanced tab. There is no need to edit profile XML file at all to change default selection logic, and multiple profiles can use the same default selection string from preferences.

This is only necessary for versions 1.7.0-1.7.2 :
To change default selection logic, one has to change rules in all 3 places, or at least the rule for "default" track. Please note that default profile should never be modified, please download attached profile template, edit the file and place into MakeMKV data directory in order to make it visible in MakeMKV. The exact rules of defaulSelection setting are posted below. Once again, do NOT download attached template if you're using latest version of MakeMKV, it's obsolete and there is no need to edit the profile file.
Attachments
profile1.mmcp.xml
Profile template for 1.7.0
(1.68 KiB) Downloaded 1549 times

mike admin
Posts: 3407
Joined: Wed Nov 26, 2008 2:26 am
Contact:

Re: Changing default track selection

Post by mike admin » Sat Dec 24, 2011 9:25 am

UPDATE: defaultSelection syntax changed in 1.7.1 and last updated in 1.7.3 . The information below is valid for MakeMKV v1.7.3 and above. Old syntax is still valid but its use is discouraged

defaultSelection is a string setting that is a comma-separated list of tokens. All tokens are evaluated from left to right. Each token has a format of {action}:{condition} . The defaultSelection name is confusing as actions control not only selection, but also order of tracks in output file. Currently supported actions are

Code: Select all

+sel - select track
-sel - unselect track
+N   - add decimal value N to track weight
-N   - subtract decimal value N from track weight
=N  - set track weight to decimal value N
Track weight controls the position of tracks in output file. For detailed description please see http://www.makemkv.com/forum2/viewtopic.php?f=10&t=4566 .

If the condition matches, the action applies. The defaultSelection expression is evaluated for each track, the initial track selection state and track weight are undefined. All tokens are always evaluated, from left to right.

The condition is a boolean expression that uses standard syntax. Tokens may be grouped by parentheses and all boolean operators are allowed. This is the list of all valid tokens

Code: Select all

<!-- defaultSelection tokens:
    all         - always matches
    xxx         - matches specific language (ISO 639-2B/T code - eng,fra,etc...)
    N           - matches if Nth (or bigger) track of the same type and language
    favlang     - matches favorite languages, always matches if no favorite language is set
    special     - matches if track is special (directors comments, childrens, etc)
    video       - matches if track is video
    audio       - matches if track is audio
    subtitle    - matches if track is subtitle
    
    video tracks:
    mvcvideo    - matches if track is a 3D multi-view video
    
    audio tracks, special tracks never match:
    mono        - matches if mono
    stereo      - matches if stereo
    multi       - matches if multi-channel
    havemulti   - matches if track is mono/stereo and there is a multi-channel track in same language
    lossy       - matches if non-lossless
    lossless    - matches if lossless
    havelossless- matches if non-lossless track, but there is a lossless track in same language
    core        - matches if this track is core audio, logical part of hd track
    havecore    - matches if this track is hd track with core audio
    
    subtitle tracks:
    forced      - matches if track is forced
    -->
This is the list of all valid operators

Code: Select all

| - logical or
& - logical and
! - logical not
~ - alias for "!", logical not
* - alias for "&", logical and (as profile is an XML file, usage of "&" symbol is tricky)
Some common examples:

"+sel:all" - all tracks will be selected
"-sel:all" - no tracks will be selected

"-sel:all,+sel:(favlang|nolang),-sel:(havemulti|havecore),=100:all,-10:favlang" - select all tracks in favorite language, all tracks without language, do not select stereo tracks if multi-channel track is available in same language, unslect HD track if it has a core track, do not select any special tracks. Assign a weight value of "100" to all tracks by default, decrement weight value by 10 for all tracks in favorite language. This is a selection rule in default profile.

"+sel:(ger|fre)" - only select all German and French tracks. Both ISO-692 2B and 2T codes would work equally fine, so "+sel:(deu|fra)" would produce the same result.

+sel:(forced&(!eng)) - select all forced tracks, but not in English language.

Locked