From a1da1c8106c17b5f5ddf6d6f0da3d3d3848271d9 Mon Sep 17 00:00:00 2001 From: Scott Garrett Date: Sun, 29 Nov 2026 14:27:08 -0500 Subject: [PATCH] Added a CHANGES.md document to keep track of what I have changed since forking. --- CHANGES.md | 211 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 211 insertions(+) create mode 100644 CHANGES.md diff --git a/CHANGES.md b/CHANGES.md new file mode 100644 index 0000000..9c69e31 --- /dev/null +++ b/CHANGES.md @@ -0,0 +1,211 @@ +# CHANGES — SublerMKV fork + +Executive summary of everything this fork adds or changes relative to the +original Subler checkout. + +- **Baseline**: upstream commit `0c3d7de` (2026-10-20, "Fix wobbling preference + panels switch animation caused by macOS 27.2") — the last commit inherited + from the GitHub Subler project. +- **Since then**: 18 commits in the app repository and 15 in the + **MP42Foundation** submodule (2026-11-25 → 2026-11-28). +- **Fork identity**: version stamped `1.9.5mkv`; development moved from GitHub + to Gitea (`git.technomancer.com:Scott-Files/`). + +## Executive summary + +Two headline capabilities, plus the packaging to support them: + +1. **Matroska files can now be opened and edited in place.** Subler previously + forced `.mkv`/`.mka`/`.mks` through a convert-to-MP4 import. The fork opens + them directly as documents: metadata, cover art, track fields, chapters, + subtitle-track additions, and track deletions all save back *as Matroska*, + without a lossy transcode and without ever writing QuickTime atoms over an + MKV. +2. **A complete BLU-RAY PGS subtitle pipeline.** Raw `.sup` PGS files import + natively; PGS tracks inside MKVs convert to VobSub (`subp`) at the stream's + **own resolution** (e.g. 1920x1080, not the old forced 720x480 DVD frame); + and subtitle filenames are recognized for language and type flags (SDH, + forced, commentary, …) the way mkvmerge does it. + +Supporting work: direct metadata lookups from IDs embedded in filenames, the +project + submodules re-hosted on Gitea, the Sparkle auto-updater removed, and +two command-line helpers (`extractsubs`, `sup2vob`) now built and shipped +inside the app bundle so they never drift from the app's own code. + +## 1. Matroska in-place editing + +*App: `eb386a5`, `3302367`, `8520d72`, `f457b4e`, `06ecb0a` — Framework: `1040f47`, `8ba3f25`, `0cf79ec`, `10dcee3`, `e8231de`* + +- **Direct open**: `.mkv/.mka/.mks` open into a tags-only `MP42File` model + instead of the convert-import sheet. MP4-only properties stay read-only; + the four fields Matroska actually stores per track — **name, language, + enabled, subtitle-forced** — are editable, along with all metadata and + cover art. +- **Two save engines** (in MP42Foundation), chosen automatically: + - `MP42MkvTagWriter` — mkvpropedit-style **in-place** rewrite of the `Tags` + element, cover-art attachment, and per-track fields. Reuses the old extent + + Void padding when the payload fits; otherwise rebuilds the file tail + with recomputed SeekHead/Cues positions (temp file + atomic replace). + Untouched tracks diff to **byte-for-byte no-ops**; foreign tag groups, + unknown TrackEntry children, and non-cover attachments are preserved + verbatim; a size+mtime staleness guard refuses writes on changed files. + - `MP42MkvRemuxer` — stream-copy **rebuild** used when the structure must + change: deleted tracks, added subtitle tracks, chapter edits, Save-As, or + File ▸ Optimize. Every block is copied bit-for-bit (blocks of removed + tracks dropped by unmarked-vint track number), clusters are header-only + scanned, SeekHead positions are patched at the end, Cues are regenerated + only when the source had them, and `Info/Duration` is recomputed from + written block extents. +- **Track management**: real tracks can be deleted (pairing TrackEntry ↔ model + by object identity, immune to index shifts); `.srt`/`.ssa`/`.ass` subtitle + tracks can be **added** (re-parsed from source at save time, written as + `S_TEXT/UTF8` with proper `BlockGroup` framing and synthesized clusters + when timestamps demand it). Reordering stays blocked on MKV to protect the + pairing; destinations must remain mkv/mka/mks. +- **Chapters are first-class**: editable rows, `.txt` (mp4chaps) import to + bootstrap chapters on a chapter-less file, `.csv` update, single-chapter + insertion (timestamped 1 s past the latest start, clamped), bulk "insert + every N", deletion of the whole chapter track (removes the `Chapters` + element). Chapter changes ride the remuxer (detected via a model snapshot), + and chapter **language round-trips** at track level. TagsOnly mode mirrors + the file's chapter atoms verbatim — no MP4-path normalization — so an + untouched save never shifts or drops atoms. +- **AppleScript**: `save as` routes Matroska documents through the proper + Matroska save path (the raw MP4 writer would corrupt them); direct file + import mirrors the panel's extension dispatch; PGS/MKV naming conventions + respected without MP4-only model reshuffling. +- **Spec traps handled** (all verified against mkvtoolnix-written files): + correct `Language`/`LanguageIETF`/`TrackFlagEnabled` element ids, + `ChapterAtom = 0xB6`, chapter timecodes in absolute nanoseconds, mandatory + `ChapterUID`/`EditionUID` derived deterministically from content, and + community-style SimpleTags (`RATING`, `CONTENTRATING`, `MEDIAKIND`, `HD`, + `CAST`, `NETWORK`, `EPISODEID`) so Movie-tab fields with no Matroska-spec + tag still round-trip. + +## 2. Subtitle pipeline + +*App: `5d6c0cd`, `dd956fa`, `87e0c82`, `401584a` — Framework: `e02f60b`, `5777208`, `837aa1c`, `30dd96f`, `e7c7b80`, `e428558`* + +- **BLU-RAY PGS `.sup` import**: `MP42VobSubImporter` claims `.sup` directly, + converting via **sup2vob** — the upstream Swift sources vendored into + MP42Foundation (`MP42/Sup2Vob/`) with only the CLI globals and facade + adapted, so upstream fixes re-merge cleanly. Result: a real VobSub track + (muxable into MP4 as `subp`, or tx3g-convertible), language taken from the + filename, track URL kept on the user's `.sup`. +- **PGS inside MKV → VobSub**: the import sheet offers a VobSub conversion + action for PGS-format tracks. Requires rebuilding the `.sup` stream from + mkvmerge's stripped-envelope, zlib-compressed blocks (reconstructing the + 13-byte `PG` segment framing byte-identically to mkvextract) before the + same sup2vob machinery runs. +- **Full source resolution**: the conversion always runs sup2vob's `--full` + passthrough — frames keep the PGS's own PCS canvas (typically 1920x1080) + instead of being downscaled to the 720x480/576 DVD frame the old code + forced. Verified end-to-end: framework output is **byte-identical** to + `sup2vob --full`, and ffprobe reports `dvd_subtitle 1920x1080` on muxed + output from both the `.sup` and the MKV path. +- **VobSub frame sizes honored**: `.sub`/`.idx` additions now mux at the + frame size declared in the idx rather than a default. +- **Filename intelligence** (mkvmerge-style, right-to-left token scan): + ISO 639-2/B and B-code language tags (`pt-BR` extended tags survive), and + community type tokens (`sdh`, `cc`, `commentary`, `forced`, `lyrics`, + deaf/hearing-impaired variants) — any flagged track is named **SDH**, the + one recognizable convention players show, which then picks up media + characteristics automatically. MKV track names run through the same + recognizer on the conversion path (track name, falling back to the MKV's + own filename). +- **Bug fix**: SSA files without a `[V4+ Styles]` section no longer fail to + parse. + +## 3. Metadata + +*App: `f20ad7e`* + +- **Direct metadata lookup from filename IDs**: names like + `Movie (2024) {tmdb-1015812}` or embedded IMDb/TVDB IDs are parsed + (ParseFilename now handles parenthesized years and brace-wrapped service + IDs, IMDb IDs widened to 7–9 digits) and emitted as `id::`. + The search sheet, the queue metadata action, and the AppleScript + fetch-metadata command try the direct TMDb lookup first and fall back to + title search when the ID is unknown or unsupported. + +## 4. Fork infrastructure and distribution + +*App: `0f8d251`, `628ccfe`, `20438f3`, `475737a`, `e96773f` — Framework: `79c251c`, `7ff1ed4`, `a287ea6`* + +- **Gitea migration**: project, README clone URLs, and the `contrib` + submodule all moved from GitHub to Gitea (SSH for development, public + HTTPS URLs in the README/submodule config). +- **Sparkle removed**: the auto-updater integration (framework, updater menu + item, feed URL/public key, SPM package reference) is gone — this fork + updates itself however its users choose. +- **Fork version stamp `1.9.5mkv`** distinguishes builds from upstream 1.9.5. +- **Xcode 27.2 project migration** for both the app and the framework. + +## 5. Command-line tools shipped in the app bundle + +*App: `c08d607`, `5111294`, `56d843c` — Framework: `72e879e`* + +- **`extractsubs`** bundles into `Contents/Resources/`: extracts subtitle + tracks from mkv/mp4 files via ffmpeg stream copy, named + `.[.]..` — exactly the shape Subler's + filename recognizer probes, so results drag straight back into the app — + and runs `sup2vob --full` on extracted PGS. Defaults to English tracks + (`--all` for everything); up-front dependency checks with clear messages; + single-invocation extraction with per-track retry; a mkvmerge/mkvextract + rescue path for `S_TEXT/WEBVTT` tracks ffmpeg cannot read. +- **`sup2vob` slim CLI** (`MP42Foundation/sup2vob/`): only `main.swift` + a + Makefile — it compiles the framework's own `MP42/Sup2Vob/` sources, so CLI + and app conversion code can never drift, and the CLI doubles as the + byte-identity oracle for the framework converter. +- **Built into the app**: the Subler build runs that Makefile (incremental) + and installs the binary at `Contents/MacOS/sup2vob`, so building Subler + refreshes the CLI, and the bundled `extractsubs` finds it as a bundle + sibling — the shipped pair needs no install beyond ffmpeg/ffprobe. + +## Appendix — commit index + +### SublerMKV (app), since `0c3d7de` + +| Commit | Subject | +|---|---| +| `eb386a5` | Open and edit Matroska files in place, including track removal | +| `3302367` | Add subtitle tracks to open Matroska documents | +| `8520d72` | Edit and add chapters in Matroska documents | +| `f457b4e` | Make chapter tracks deletable, insertable, and language-editable | +| `06ecb0a` | Route AppleScript chapter imports and make File > Optimize work on MKV | +| `401584a` | Mux added VobSub tracks at the frame size declared in the idx | +| `f20ad7e` | Search metadata directly from IDs embedded in file names | +| `0f8d251` | Point the project at Gitea and document the fork | +| `628ccfe` | Use the gitea SSH login in clone URLs | +| `20438f3` | Pull the contrib dependency from Gitea too | +| `475737a` | Drop the Sparkle updater and stamp the fork version 1.9.5mkv | +| `e96773f` | Point the submodule and README at the public HTTPS URLs | +| `5d6c0cd` | Add PGS .sup subtitle import and filename flag recognition | +| `dd956fa` | Offer VobSub conversion for PGS subtitle tracks | +| `87e0c82` | Document the sup2vob full-frame passthrough for PGS conversions | +| `c08d607` | Ship the extractsubs subtitle-extraction helper with the app | +| `56d843c` | Document the slim sup2vob CLI in the submodule | +| `5111294` | Build sup2vob into the app bundle so it ships and stays fresh | + +### MP42Foundation (submodule), same period + +| Commit | Subject | +|---|---| +| `1040f47` | Add Matroska tagging and track-removal support | +| `e428558` | Fix SSA header parsing for files without a [V4+ Styles] section | +| `8ba3f25` | Write added subtitle tracks during Matroska remux | +| `0cf79ec` | Rebuild Matroska chapters on remux and recompute Info Duration | +| `10dcee3` | Round trip the chapter language between model and Matroska | +| `e8231de` | Mirror the file's chapter atoms verbatim in tagsOnly mode | +| `e7c7b80` | Mux VobSub subpic tracks at the frame size declared by the idx | +| `79c251c` | Move the contrib submodule to Gitea | +| `a287ea6` | Adopt Xcode 27.2 project migration | +| `7ff1ed4` | Serve the contrib submodule URL over HTTPS | +| `30dd96f` | Recognize subtitle language and type tokens in filenames | +| `e02f60b` | Import BLU-RAY PGS .sup files via vendored sup2vob | +| `5777208` | Convert Matroska PGS tracks to VobSub and name flagged tracks SDH | +| `837aa1c` | Keep the PGS source resolution through the sup2vob conversion | +| `72e879e` | Add a slim sup2vob CLI built from the vendored Sup2Vob sources | + +*(The submodule's pre-fork history was re-hosted on Gitea, so its commits are +listed by date range rather than as a range from the base checkout.)*