Skip to content

Add DVD text subtitle rendering to the authoring pipeline#19

Merged
ScottMorris merged 8 commits intomainfrom
feat/issue-17-text-subtitle-rendering
Apr 4, 2026
Merged

Add DVD text subtitle rendering to the authoring pipeline#19
ScottMorris merged 8 commits intomainfrom
feat/issue-17-text-subtitle-rendering

Conversation

@ScottMorris
Copy link
Copy Markdown
Contributor

Closes #17

Summary

User-facing changes

  • Text subtitle authoring: Add a first-pass DVD text subtitle path that prepares supported text subtitle streams with FFmpeg, then renders and composes them onto authored title MPEGs with spumux.
  • Build progress: Surface explicit renderTextSubtitles work in the build model and Build page so subtitle rendering appears as its own visible stage.
  • Validation: Replace the old unsupported-text warning with guidance that reflects the shipped first-pass behaviour and host-font styling limits.

Workflow runtime

  • Planner shape: Add RenderTextSubtitles jobs, keep text subtitle work outside the base title transcode, and preserve mixed bitmap/text subtitle mapping order in the authored output plan.
  • Execution diagnostics: Add a clearer host-font hint when subtitle composition fails and keep the compose seam bounded to the subtitle render job.
  • Coverage: Add regression coverage for text subtitle planning and mixed subtitle ordering, plus an ignored smoke test for text subtitle authoring when the full toolchain is available.

Documentation

  • Capability docs: Update README.md, SPEC.md, and the DVD subtitle docs to describe first-pass text subtitle rendering as shipped behaviour.
  • Limit notes: Keep the docs honest about host-font dependence and simplified DVD-safe styling without carrying forward the outdated mixed-order limitation.

Test plan

  • docker run --rm -v "$PWD":/workspace -w /workspace ghcr.io/liminal-hq/tauri-dev-desktop:latest bash -lc 'cargo fmt --all --check && cargo test -p tauri-plugin-spindle-project --no-run'
  • docker run --rm -v "$PWD":/workspace -w /workspace ghcr.io/liminal-hq/tauri-dev-desktop:latest bash -lc 'cargo test -p tauri-plugin-spindle-project build_plan_renders_text_subtitles_after_base_transcode -- --nocapture'
  • docker run --rm -v "$PWD":/workspace -w /workspace ghcr.io/liminal-hq/tauri-dev-desktop:latest bash -lc 'cargo test -p tauri-plugin-spindle-project build_plan_preserves_mixed_subtitle_stream_order -- --nocapture'
  • docker run --rm -v "$PWD":/workspace -w /workspace ghcr.io/liminal-hq/tauri-dev-desktop:latest bash -lc 'pnpm -C apps/spindle exec tsc --noEmit'
  • docker run --rm -v "$PWD":/workspace -w /workspace ghcr.io/liminal-hq/tauri-dev-desktop:latest bash -lc 'cargo test -p tauri-plugin-spindle-project execute_build_plan_smoke_authors_text_subtitle_stream -- --ignored --nocapture'

The ignored smoke test is checked because the test target exists and was invoked successfully, but it skipped in the container because ffmpeg was not available on PATH in that image.

**What changed**
- add explicit `RenderTextSubtitles` build jobs and subtitle render-mode support in the Rust and TypeScript models
- prepare text subtitle streams through FFmpeg, compose them onto authored title MPEGs with `spumux`, and surface the work on the Build page
- preserve mixed bitmap and text subtitle mapping order in the planner and add regression coverage for the ordering and text-render planning paths
- improve render-step diagnostics with a host-font hint when subtitle composition fails

**Why**
- issue `#17` needs real DVD text subtitle authoring instead of warning-only handling
- explicit render jobs and order-aware planning make the build output and progress reporting match the authored subtitle intent more closely
- stronger tests and clearer diagnostics reduce the risk of silent subtitle regressions during authoring
**What changed**
- update the product summary and spec to describe first-pass text subtitle rendering as shipped DVD capability
- revise the DVD authoring notes and subtitle plan so they describe the hybrid FFmpeg plus `spumux` seam that the build now uses
- remove the outdated mixed-order limitation from the docs now that the planner keeps subtitle mapping order intact

**Why**
- issue `#17` changes the shipped subtitle authoring surface, so the repository docs need to describe the real behaviour and its remaining first-pass limits
- keeping the docs aligned with the implementation avoids misleading review, QA, and release notes work
@ScottMorris ScottMorris added enhancement New feature or request backend Rust backend, commands, and native runtime behaviour plugin Plugin work rust Rust tooling, code, or integration work assets Media import, inspection, and asset management work build-pipeline Authoring, encoding, packaging, and export pipeline work labels Apr 3, 2026
@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 3, 2026

Spindle JS tests

26 tests  ±0   26 ✅ ±0   0s ⏱️ ±0s
 3 suites ±0    0 💤 ±0 
 1 files   ±0    0 ❌ ±0 

Results for commit 5f65ac6. ± Comparison against base commit 2eb52d6.

♻️ This comment has been updated with latest results.

@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 3, 2026

Spindle Rust tests

94 tests  +7   94 ✅ +7   1s ⏱️ -1s
 1 suites ±0    0 💤 ±0 
 1 files   ±0    0 ❌ ±0 

Results for commit 5f65ac6. ± Comparison against base commit 2eb52d6.

This pull request removes 1 and adds 8 tests. Note that renamed tests count towards both.
tauri-plugin-spindle-project ‑ build::authoring::tests::dvdauthor_xml_escapes_subpicture_language_values
tauri-plugin-spindle-project ‑ build::authoring::tests::dvdauthor_xml_normalises_bibliographic_french_language_code
tauri-plugin-spindle-project ‑ build::authoring::tests::dvdauthor_xml_normalises_subpicture_languages_for_dvdauthor
tauri-plugin-spindle-project ‑ build::authoring::tests::dvdauthor_xml_omits_invalid_subpicture_language_values
tauri-plugin-spindle-project ‑ build::executor::tests::execute_build_plan_skips_empty_text_subtitle_passes
tauri-plugin-spindle-project ‑ build::executor::tests::subtitle_file_has_cues_rejects_empty_and_whitespace_only_files
tauri-plugin-spindle-project ‑ build::planner::tests::build_plan_preserves_mixed_subtitle_stream_order
tauri-plugin-spindle-project ‑ build::planner::tests::build_plan_renders_text_subtitles_after_base_transcode
tauri-plugin-spindle-project ‑ build::planner::tests::build_plan_skip_unsupported_streams_removes_text_subtitles

♻️ This comment has been updated with latest results.

**What changed**
- restore the `skip unsupported streams` escape hatch so builds can strip text subtitle mappings instead of scheduling render jobs
- resolve text subtitle fonts through Fontconfig from a small sans-serif shortlist rather than hard-coding a single alias
- add validation for missing host subtitle fonts and a regression test that covers the skip-text fallback path
- apply the formatting cleanup needed for the updated subtitle authoring docs and Rust sources

**Why**
- the review found that the existing fallback no longer let users author a subtitle-free disc when text subtitle rendering was unavailable
- relying on one host-specific font alias made the new authoring path too machine-dependent and could fail late during build execution
- early validation and a tested fallback make the text subtitle path safer without hiding the first-pass host-font constraint
**What changed**
- treat zero-cue extracted text subtitle files as a handled runtime outcome during authoring
- carry the current authored MPEG forward when a subtitle pass is skipped so later passes still chain correctly
- add executor coverage for empty and whitespace-only prepared subtitle files

**Why**
- trimmed sample clips can legitimately include subtitle streams that have no cues in the authored range
- builds should continue when subtitle extraction succeeds structurally but produces no usable subtitle text for the selected portion
**What changed**
- normalise recognised three-letter subtitle languages to the two-letter codes that `dvdauthor` accepts in `<subpicture>` declarations
- omit the `lang` attribute when a subtitle language cannot be made DVD-safe
- add authoring coverage for normalised and invalid subtitle language values

**Why**
- real projects can carry ISO 639-2 style values such as `eng` and `fre` in subtitle mappings
- `dvdauthor` rejects those values during final authoring, even when the rest of the build has succeeded
**What changed**
- add `isolang` to normalise subtitle language codes before writing `dvdauthor` subpicture declarations
- accept both ISO 639-1 and ISO 639-3 inputs, and trim simple region suffixes such as `en-US`
- keep the existing fallback of omitting `lang` when a subtitle language cannot be mapped safely

**Why**
- a library-backed mapping is easier to trust and maintain than a local hand-written conversion table
- this keeps the `dvdauthor` fix focused on behaviour while moving the code-to-code mapping burden onto a dedicated crate
**What changed**
- canonicalise common ISO 639-2/B bibliographic subtitle codes such as `fre` before passing them through `isolang`
- document why the alias shim exists at the `dvdauthor` normalisation boundary
- add regression coverage for the French bibliographic code path

**Why**
- source media metadata can legitimately report bibliographic language codes even when `dvdauthor` needs a two-letter output tag
- `isolang` handles canonical 639-3 values well, but the bibliographic alias layer still needs a small compatibility shim
@ScottMorris
Copy link
Copy Markdown
Contributor Author

@codex review

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 254ae48e4f

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

**What changed**
- stop failing build planning when Fontconfig cannot resolve a host subtitle font
- fall back to a generic `sans-serif` font-family hint for `spumux` when `fc-match` is unavailable
- update the validation warning so it reflects the fallback behaviour more accurately

**Why**
- `spumux` can still attempt generic family or path-based font resolution even when Fontconfig is not present
- blocking planning on `fc-match` availability was stricter than the authoring toolchain itself and could reject otherwise valid text subtitle builds
@ScottMorris ScottMorris merged commit 7fa0283 into main Apr 4, 2026
8 checks passed
@ScottMorris ScottMorris deleted the feat/issue-17-text-subtitle-rendering branch April 4, 2026 17:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

assets Media import, inspection, and asset management work backend Rust backend, commands, and native runtime behaviour build-pipeline Authoring, encoding, packaging, and export pipeline work enhancement New feature or request plugin Plugin work rust Rust tooling, code, or integration work

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add text subtitle rendering for DVD authoring

1 participant