Blu-ray Playlist Detection Logic — Adaptive MakeMKV + Python Heuristic Framework

Please post here for issues related to Blu-ray discs
Post Reply
yeahIdidit
Posts: 5
Joined: Tue Oct 21, 2025 9:26 pm

Blu-ray Playlist Detection Logic — Adaptive MakeMKV + Python Heuristic Framework

Post by yeahIdidit »

Blu-ray Playlist Detection Logic — Adaptive MakeMKV + Python Heuristic Framework

This post outlines a neutral, data-driven workflow for identifying feature playlists on UHD and Blu-ray discs.
Built around MakeMKV’s command-line output and adaptive Python heuristics, the system combines metadata validation with Scenarist-style analysis to automatically detect theatrical and extended cuts — even on complex or obfuscated authoring structures.

The goal is to demonstrate a neutral, data-driven process that automatically determines the correct Theatrical, Extended, or Alternate playlists — even on heavily obfuscated discs containing hundreds of MPLS files.

--------------------------------------------------------------------
Core Objective
--------------------------------------------------------------------
Automate feature playlist detection by combining low-level MPLS analysis, MakeMKV enrichment, and statistical heuristics to eliminate manual trial-and-error and ensure deterministic identification of valid feature cuts.

--------------------------------------------------------------------
System Components
--------------------------------------------------------------------

1. Python Engine
• Parses all .mpls files directly
• Computes segment fingerprints, durations, chapter counts, and item totals (IT)
• Integrates MakeMKV output via makemkvcon --robot info for metadata enrichment
• Generates JSON and CSV outputs for full transparency and reproducibility

2. MakeMKV Integration
• Provides authoritative duration, chapter, and segment count data
• Corrects zero-duration MPLS headers common on UHDs
• Acts as a secondary validation source for Python-calculated results

3. Adaptive Heuristic Engine
• Groups playlists by duration, chapter count, and fingerprint hash
• Uses Median + MAD (Median Absolute Deviation) for adaptive tolerance
• Automatically adjusts to the complexity of each disc — no hardcoded thresholds
• Chooses representative winners within each duration cluster
– Longest = Extended
– Shorter = Theatrical
– Identical maps = Aliases

--------------------------------------------------------------------
Twin-Cut and Multi-Edition Logic
--------------------------------------------------------------------
Label | Criteria | Description
------|-----------|-------------
Theatrical | Shorter of top two clusters | Canonical runtime
Extended | Longer (≥5 min diff) | Director’s / Special Cut
Extended Alt | ±3 min variation | Re-author or hybrid variant
Single_Title | Only one valid cluster | Standard disc, no alternates

Aliases are automatically linked — no user intervention required.

--------------------------------------------------------------------
Decision Flow Summary
--------------------------------------------------------------------
Mount ISO or BDMV
→ Parse MPLS files → Compute duration & fingerprint
→ Call makemkvcon --robot info → Enrich missing data
→ Cluster playlists (adaptive median/MAD window)
→ Determine feature cuts (theatrical / extended / alt / single)
→ Launch tsMuxer GUI for the detected MPLS
→ Export JSON + CSV reports

--------------------------------------------------------------------
Example Output — Black Hawk Down UHD
--------------------------------------------------------------------
PEG Primary Summary
-----------------------------------------------------------
CUT MPLS DURATION CH IT
-----------------------------------------------------------
THEATRICAL 00501 2:24:18 16 37
EXTENDED 00503 2:31:50 16 37
ALIAS 00504 2:31:50 16 37
ALIAS 00502 2:24:18 16 37
-----------------------------------------------------------
Cluster overview (family → members, item_count_hint, winner)
-----------------------------------------------------------
dur:0151 → members=2 items≈37 winner=00503
dur:0144 → members=2 items≈37 winner=00501
[OK] Opening 00503.mpls in tsMuxer GUI

Result: Automatically identified both Theatrical and Extended cuts, matching verified runtimes.
174 total MPLS files parsed, enriched, and clustered — completed without manual review.

--------------------------------------------------------------------
Why It Works Reliably
--------------------------------------------------------------------
• Combines MakeMKV’s validated metadata with Scenarist-level binary parsing
• Uses statistical adaptation rather than fixed thresholds
• Neutral evaluation — results determined solely by observed data
• Supports single or twin-feature UHDs seamlessly
• Fully self-cleaning (auto-mount, scan, unmount)
• Produces machine-readable JSON and CSV reports for archival or pipeline use

--------------------------------------------------------------------
Validated Test Cases
--------------------------------------------------------------------
• Black Hawk Down UHD (174 playlists) → Theatrical + Extended
• Robin Hood UHD (116 playlists) → Twin-cut with aliases
• The Manhattan Project BD → Single short feature verified

--------------------------------------------------------------------
Future Enhancements
--------------------------------------------------------------------
• Optional --open=[theatrical|extended|auto] CLI flag
• Cross-validation with MKVToolNix segment maps
• Optional Dolby Vision / HDR10+ metadata extraction post-scan

--------------------------------------------------------------------
Acknowledgement
--------------------------------------------------------------------
This logic is designed to remain neutral, adaptive, and fully data-driven.
Any disc image readable by MakeMKV can be analysed, with MakeMKV providing the critical metadata foundation that makes this possible.

Sincere thanks to the MakeMKV development team for providing such a powerful and precise tool — its command-line output and reliability form the cornerstone of this workflow.
yeahIdidit
Posts: 5
Joined: Tue Oct 21, 2025 9:26 pm

Re: Blu-ray Playlist Detection Logic — Adaptive MakeMKV + Python Heuristic Framework

Post by yeahIdidit »

If anyone has any discs that they struggle to find the correct playlist for, please post them in here, and when I can grab the source, I will try running the script over it to give results
Post Reply