Open source CapCut alternative.
TypeScript
feat(app): burn subtitles in by default with a soft fallback
David Le676497106a58
diff --git a/apps/Donkey/Sources/DonkeyRuntime/Resources/BuiltInSkills/media/SKILL.md b/apps/Donkey/Sources/DonkeyRuntime/Resources/BuiltInSkills/media/SKILL.mdindex 5040af58..4800974b 100644--- a/apps/Donkey/Sources/DonkeyRuntime/Resources/BuiltInSkills/media/SKILL.md+++ b/apps/Donkey/Sources/DonkeyRuntime/Resources/BuiltInSkills/media/SKILL.md@@ -50,8 +50,8 @@ Get the subtitle text, then apply it. Prefer the cheapest source that gives corr- `-c copy` cuts on frame boundaries, so a segment's real length is not exactly 600s. Read each one's true duration with `ffprobe -v error -show_entries format=duration -of csv=p=0 seg_000.mp3` and accumulate; that running sum is the next segment's start offset — do not assume `index × 600`.- Transcribe each segment with a plain zero-based prompt (`"Transcribe to SRT with timestamps"`), then add the accumulated offset to every cue in that segment's SRT and concatenate in order, renumbering cue indices. Sanity-check that timestamps only increase. Persist the assembled SRT with `files.write path=~/Downloads/subs.srt content=…` (the whole multi-line file in one call) — not a shell heredoc.5. **Apply to the video (ffmpeg):**- - Burn-in (default for a shareable clip — always-visible, what social players expect): `ffmpeg -i clip.mp4 -vf "subtitles=subs.srt" -c:a copy out.mp4`. The bundled ffmpeg ships with libass, so this works out of the box. If it ever fails with `No such filter: 'subtitles'` (a stripped ffmpeg without libass), fall back to the soft track below and tell the user why.- - Soft, toggleable track (offer for an archive copy): `ffmpeg -i clip.mp4 -i subs.srt -c copy -c:s mov_text out.mp4`.+ - Burn-in (default for a shareable clip — always-visible, what social players expect): `ffmpeg -i clip.mp4 -vf "subtitles=subs.srt" -c:a copy out.mp4`. Donkey's bundled ffmpeg includes libass, so this works by default. If you ever do hit a filtergraph error — `No such filter: 'subtitles'`, `Error parsing filterchain 'subtitles=…'`, or `No option name near '…'` — that is an ffmpeg without libass, **not** a path problem: don't retry the same command or fiddle with absolute-vs-relative paths or escaping. Switch straight to the soft track below (no libass needed) and tell the user you delivered a toggleable subtitle track instead of burned-in text.+ - Soft, toggleable track (the reliable fallback, and fine for an archive copy): `ffmpeg -i clip.mp4 -i subs.srt -c copy -c:s mov_text out.mp4`. This muxes the translation into the file as a real subtitle stream with no libass and no re-encode, so it works even when burn-in can't.- Model timestamps are approximate (good enough for subtitles); always extract audio before transcribing, and chunk long files.## Verify