Repository navigation
fix(ffmpeg): fail fast when ffmpeg lacks the drawtext filter - #44
Merged
Merged
Conversation
Since FFmpeg 6.1, drawtext needs libharfbuzz as well as libfreetype, and the Linux FFmpeg 7.0.2 build that ffmpeg-static 5.3.0 installs has no harfbuzz. add_text, add_captions, add_title_card and timeline text clips died there with FFmpeg's raw "No such filter: 'drawtext'". List the resolved FFmpeg's filters once per process and throw MissingFilterError before any text render, naming the binary and how to point MAKEMYCLIP_FFMPEG_PATH at a build that has drawtext. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…hoice Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
🎉 This PR is included in version 0.3.1 🎉 The release is available on:
Your semantic-release bot 📦🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Stacked on #43. Base is
fix/ffmpeg-path-escaping, so both land onmaintogether in a single v0.3.1 release.What
src/ffmpeg/run.tsgainslistFilters(), which runsffmpeg -hide_banner -filtersonce per process (a failed listing isn't cached). It also gainsrequireDrawtext(), which throws a typedMissingFilterError(withfilterandffmpegPath) before any text render.add_text,add_title_cardandrunPlan(only for plans that carry text files) call it first.add_captionsgoes throughadd_textfor each cue, so the first cue stops it.MissingFilterErroris exported from the package entry.MAKEMYCLIP_FFMPEG_PATHto an FFmpeg with drawtext (for exampleapt install ffmpeg, then/usr/bin/ffmpeg), and forclip mcp, set it in the MCP client config's env.tests/integration/filter-escape.test.tsreuseslistFilters()and adds a CI case: without drawtext,add_textthrowsMissingFilterError. The drawtext escaping cases still run only where the filter exists.docs/backlog/drawtext-on-linux.mdis narrowed to the open binary-source decision.Why
On Linux,
ffmpeg-static5.3.0 downloads John Van Sickle's FFmpeg 7.0.2 build. That build has libfreetype but no libharfbuzz, and since FFmpeg 6.1 drawtext requires both (drawtext_filter_deps="libfreetype libharfbuzz"in FFmpeg'sconfigure). So every text path died with FFmpeg's rawNo such filter: 'drawtext'. The bundled macOS binary (FFmpeg 6.0) and the Windows build have drawtext. Upstream tracks this as eugeneware/ffmpeg-static#147. Its fix, eugeneware/ffmpeg-static#158, moves Linux x64 to BtbN builds; it has been open since 2026-07-16 with no maintainer reply, and the last release was 5.3.0 on 2025-11-14.This PR doesn't make text render on Linux by default. Doing that means changing the binary source; see the decision below.
Decision: keep option A for now
The owner picked A on 2026-10-29: keep
ffmpeg-staticplus this check, and don't swap the binary source. The backlog note records it, to revisit whenffmpeg-staticships a Linux build with drawtext. The options considered:ffmpeg-staticplus this fail-fast checkMAKEMYCLIP_FFMPEG_PATHffmpeg-static6 (#158)@radically-straightforward/ffmpeguses BtbN 7.1.1 on Linux;node-avships jellyfin-ffmpeg 8.1)assfilter), which the current Linux binary hasAny real fix should also pass
fontfile=. drawtext without it falls back to fontconfig's default font, and slim containers have none. DejaVu Sans (Bitstream Vera license, 757 KB) is a candidate to bundle.Checks
pnpm lint: pass (7 warnings, none in changed files)pnpm type-check: passpnpm test(macOS arm64, bundled FFmpeg 6.0): 575 passed, 8 skippedCI=trueintegration tests on macOS: 16 passed, 1 skipped (the drawtext cases run; the no-drawtext case skips)pnpm build: passnode:24-bookworm, bundled FFmpeg 7.0.2 without drawtext):CI=true pnpm test: 583 passed, 5 skipped;add_text stops with MissingFilterErrorran and passedclip add_text: exits 1 with the new message instead ofNo such filterapt install ffmpeg(5.1.9, has drawtext) andMAKEMYCLIP_FFMPEG_PATH=/usr/bin/ffmpeg:clip add_text: renders the output fileapt install ffmpeg(amd64) gives an FFmpeg with drawtext on Ubuntu 24.04 (6.1.1) and Ubuntu 26.04 (8.0.1), so the error message's advice holds there toocodex review --base origin/fix/ffmpeg-path-escaping, gpt-6.1-sol): "No actionable regressions were found." Nothing to fix or rebut. The gstack gate reads UNVERIFIED only because the review has no severity tags.