# Illustrative local subtitle demo / 本地字幕格式演示 This is self-authored demo material, not user media or footage from YouTube/X. `input.mp4` is an eight-second 640×360 H.264/AAC file with a plain background and synthetic English speech: “Hello, this is a subtitle test. The blue train arrives at the station.” The text is written for this project. There is no embedded subtitle track. `cues.json` contains two manually authored timestamps and English/Chinese text. `sample.srt` and `sample.vtt` are generated using `core/subtitle-format.js` in bilingual mode. They are **illustrative format samples**, not observed ASR or translation outputs, timing measurements or quality benchmarks. Real processing may return different words, translations, timestamps and coverage. Download the MP4, open `/player`, choose the file and verify playback. To request real subtitles, sign in with available credits, choose the source/target languages, then click Start translation and play the spoken section. This is an optional real processing action; merely opening the file does not submit a translation job. The separate SRT/VTT examples are for inspecting formats or loading in a compatible external player; they are not a claim of standalone SRT import in Local Player. 本例是自写文字与合成语音,不含真实用户或平台视频。两条字幕的时间戳、原文和译文 由人工编写,再经产品序列化器生成 SRT/VTT;它们仅为格式示例,不是识别实测结果。 下载 MP4 后可选择本地文件确认播放。若要实际处理,需登录、有可用点数、选语言并 点击「开始翻译」。实际结果和覆盖范围可能不同。独立字幕文件可在外部兼容播放器 使用,不表示本地播放器具有独立 SRT 导入功能。 ## Reproduce / 复现 From the repository root on macOS with Node.js, ffmpeg, `say` and `afconvert`: run the following through the configured host runtime (`mdr run --auto --kind test`) when available. Work in a temporary directory for intermediates. The existing `scripts/speech-fixture.mjs` uses the Samantha system voice to write `speech.wav`. Voice versions/encoder metadata can change binary bytes; this recipe reproduces content and format, not a promised cross-version binary hash. ```js import { makeSpeechWav } from './scripts/speech-fixture.mjs'; makeSpeechWav('/absolute/path/to/temporary-directory'); ``` ```sh ffmpeg -f lavfi -i 'color=c=0x182b43:s=640x360:r=24:d=8' \ -i /absolute/path/to/temporary-directory/speech.wav -af apad -t 8 \ -c:v libx264 -pix_fmt yuv420p -c:a aac -b:a 64k -movflags +faststart input.mp4 ``` Regenerate the text examples from the checked-in cues using the product serializer: ```js import { readFile, writeFile } from 'node:fs/promises'; import { formatSubtitles } from './core/subtitle-format.js'; const dir = 'hosts/site/assets/subtitle-demo'; const cues = JSON.parse(await readFile(`${dir}/cues.json`, 'utf8')); for (const format of ['srt', 'vtt']) { await writeFile(`${dir}/sample.${format}`, formatSubtitles(cues, format)); } ``` No Provider credentials, account data or real-user video are needed to regenerate these illustrative assets. This sample does not include a burned-in MP4 output.