Stage 01
Turn the content workflow into explicit contracts.
The first decision was not a model. It was the deliverable chain: script → authorized voice reference → generated speech → images and optional captions → H.264/AAC MP4 → publishing preparation.
- Define users and outputs. Separate clients who need finished media from operators who need reusable local tools.
- Define required inputs. TTS needs target text and a voice strategy; video needs audio and at least one image.
- Define optional inputs. Reference transcript, emotion, voice description, narration script, title, subtitle, and styling must not block unrelated paths.
- Record consent boundaries. Voice cloning requires authorization; model-weight commercial terms are reviewed independently.
- Choose a local-first architecture. Python, MLX or PyTorch/MPS, Flask, PIL, FFmpeg, and ffprobe keep source media and intermediate data on the workstation.
Acceptance:Every stage has named inputs, outputs, failure states, and validation criteria.
Stage 02
Build the IndexTTS2 multi-model speech workstation.
- Audit each upstream engine. Identify runtime, checkpoints, sample rate, modes, token limits, and license boundaries before UI integration.
- Create adapter entry points. The working paths include
mlx_indextts/webui.py,generate_v25.py,generate_omnivoice.py, andgenerate_voicestudio.py. - Normalize the interface. Adapters accept target text plus only the inputs their engine supports, then return audio and structured progress.
- Keep parameters model-specific. Emotion vectors, descriptions, speaker maps, temperatures, and chunk sizes are restored per engine rather than leaked across switches.
- Load on demand. The selected engine is initialized at generation time; the previous engine and caches are released when switching.
- Build the voice library. Store authorized reference audio, display name, transcript, origin, and model-specific conditioning in stable records.
- Align clone references. OmniVoice uses exact reference transcripts; local ASR can create a draft that remains reviewable.
- Chunk safely. Split at sentence punctuation below each engine's safe length; avoid breaking numbers, names, and dialogue markers where possible.
- Expose job control. Progress, estimated time, stop signals, logs, and completed segment preservation make long jobs operable.
- Normalize outputs. Convert model-specific sample rates into the requested WAV, MP3, or FLAC deliverable without hiding the source rate.
Result:Five engine paths share one UI while retaining their real differences and limitations.
Stage 03
Build the automated MP4 homepage generator.
- Create the upload workflow. The Flask UI collects audio, ordered images, optional script, title, subtitle, output orientation, and style settings.
- Validate and persist a job.
POST /api/generatechecks extensions and required media, creates a unique directory, and returnsjob_idimmediately. - Run asynchronously. State moves through
pending → running → doneorerror; inputs, logs, intermediates, result JSON, and MP4 remain isolated by job. - Normalize images.
scripts/make_homepage_bg.pyapplies EXIF orientation, canvas rules, even dimensions, and title/subtitle overlays on the first image only. - Derive the visual timeline. One image spans the audio; multiple images run
1 → 2 → ... → N → 1, with the homepage capped at three seconds at each end. - Parse narration. Markdown headings are ignored and prose is split at natural Chinese or English sentence boundaries.
- Detect speech pauses. FFmpeg
silencedetectfinds candidate boundaries; the longest internal pauses map sentences to absolute timestamps. - Render caption assets. PIL creates transparent per-sentence PNGs with dynamic size and subtitle-region avoidance.
- Compose once.
scripts/compose_video.pyassembles timeline, overlays, captions, and audio with FFmpeg filter expressions. - Prefer hardware, preserve fallback. macOS uses
h264_videotoolbox + aac_at; failures fall back tolibx264 ultrafast + AAC. - Probe and expose the result. ffprobe checks duration, dimensions, and codecs; status, preview, download, history, and logs use the same persisted job data.
Result:Audio duration drives the final video, while images and captions remain deterministic and inspectable.
Stage 04
Scale from a sample to 100,000 or 200,000 characters.
- Freeze approved copy. Version scripts before synthesis so retries do not mix revisions.
- Create a manifest. Assign IDs to project, chapter, section, batch, and segment.
- Hash the inputs. Text, voice, engine, and parameters determine whether an existing result can be reused.
- Queue bounded work. The current WebUI protects one task at 100,000 characters; larger projects use chapter batches.
- Checkpoint every segment. Completion is recorded after durable audio is written, enabling resume after interruption.
- Retry narrowly. Shorten or regenerate only failed segments instead of restarting the full project.
- Post-process consistently. Normalize sample rate, loudness, pauses, metadata, and naming, then merge at chapter or full-project level.
- Drive long video from audio. The generator has no separate editorial duration ceiling; practical bounds are disk, encoding time, playback, and platform limits.
- Choose delivery shape. A multi-hour MP4 can be produced, while chapters or episodes are often easier to verify and publish.
Commercial scope:No fixed project-level word-count or video-duration ceiling; the production plan determines batching and delivery form.
Stage 05
Test quality, failures, and recovery rather than only the happy path.
- Input tests. Reject missing files, unsupported extensions, empty text, corrupt audio, and impossible parameter combinations with actionable messages.
- Engine smoke tests. Run a short fixed sentence for every backend after dependency or checkpoint changes.
- Audio checks. Verify nonzero duration, expected sample rate, finite samples, peak range, audible content, and requested container.
- Long-form checks. Compare manifest count to output count and detect missing, duplicated, or reordered segments.
- Video checks. Probe H.264/AAC, dimensions, even pixel sizes, faststart, audio/video duration, first/last homepage, and caption bounds.
- Fallback tests. Force hardware-encoder failure, missing transcript, insufficient pauses, stop requests, and restart/resume paths.
- Visual UI checks. Review compact and wide widths, long voice names, model-specific controls, logs, progress, and destructive actions.
- Acceptance sample. Deliver representative audio and MP4 samples before a large run fixes the final voice, pacing, image rules, and format.
Completion means:The result is playable, structurally correct, traceable to settings, and recoverable when a step fails.
Stage 06
Publish documentation that AI agents can retrieve without reverse engineering the UI.
- Use stable routes. Separate home, case studies, model comparison, development record, and machine endpoints.
- Write literal headings. Product names, operations, inputs, outputs, strengths, and limitations appear in HTML text, not only images.
- Keep semantic structure. Native headings, lists, tables, code, links, and language declarations create a usable document outline.
- Add structured data. Schema.org
ProfessionalService,SoftwareApplication,HowTo,FAQPage, andItemListdescribe page intent. - Expose machine files.
/llms.txt,/llms-full.txt,/api/site.json,/api/models.json, and/api/development.jsonrepeat key facts in compact form. - Support language discovery. Chinese is the default; English pages use canonical and reciprocal
hreflanglinks. - Allow crawling. Robots, sitemap, canonical URLs, text links, and descriptive metadata provide explicit discovery paths.
- Preserve contact facts. The visible address and inquiry form use wangdexin2008@126.com without requiring script execution to discover it.
Agent endpoints:development JSON · model JSON · full context
Next evidence