Repository navigation
fix(parsers): find FFmpeg and FFprobe installed by the project's npm installer packages - #5434
Merged
Merged
Conversation
…installer packages
Contributor
Edit accuracy: accurate 2061 (base branch 2061), smooth 1502 of thoseThe gate passes. Quarantined, measured but not gated (0) |
…and works with pnpm
…pm installer package
jrusso1020
approved these changes
Oct 10, 2026
jrusso1020
left a comment
Collaborator
There was a problem hiding this comment.
Reviewed at 9955457b.
- Order. The installer packages are tried last: after the env override, PATH,
.hyperframes/bin, and the common install folders. So a system FFmpeg always wins over the older npm builds, as the comment says. On Windows, where there are no common folders, the installer package is the fallback after PATH. - Lookup.
findInInstallerPackageonly resolvespackage.jsonpaths throughcreateRequireand never loads the package. It tries the platform package through the installer package first, for pnpm's isolated layout, then from the project. It returns a candidate only ifisExecutablePathCandidateaccepts it, and uses.exeon Windows. A missing package throws insidetryResolveand reads as not found. - Cost. It's a few synchronous resolutions inside the system search, with no spawn, and the result is cached like the other system lookups.
- With #5439. Both rewrite
lookupOnSystemand the doc comment inffBinaries.ts, so whichever lands second needs a rebase. They compose: the installer lookup runs inside the search, and on a miss #5439 re-runs it every 5 s.
Note, not blocking: this lookup resolves from the current directory, but the cache is per binary for the process, so a long-running server that serves several projects keeps the first project's answer. .hyperframes/bin already behaves the same way.
Required checks are green at this head, including Windows render and tests.
— Rames
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.
What changes for the user
A project that installs FFmpeg through npm (
@ffmpeg-installer/ffmpegand@ffprobe-installer/ffprobein its ownpackage.json) can now render without FFmpeg on the systemPATH. Before,npx hyperframes renderon such a Windows project stopped with "FFmpeg not found; FFprobe not found", and the only workaround was to prepend those packages' folders toPATHby hand.Root cause
The FFmpeg/FFprobe lookups for CLI preflight and capture, engine render and the Studio server go through one resolver,
findFfBinaryinparsers/src/ffBinaries.ts. It checked the env overrides,PATH, the project's.hyperframes/binand common Unix install folders, but never the project's own npm-installed FFmpeg, so a binary sitting in the project'snode_moduleswas invisible.Fix
findFfBinarynow also checks an installer package as its last fallback, after.hyperframes/binand the common Unix install folders, so any system FFmpeg wins over the old builds those packages ship. With Node's module resolution from the current directory (so itsnode_modules, a parent folder's, orNODE_PATH) it finds@ffmpeg-installer/ffmpeg(or@ffprobe-installer/ffprobe), resolves the platform package@ffmpeg-installer/<platform>-<arch>from there (so pnpm's isolated layout works) or else from the project (hoisted layouts), and returns theffmpeg/ffmpeg.exefile in it only if it is executable. The Unix@ffprobe-installerpackages shipffprobewithout the execute bit and rely on a postinstallchmod; when install scripts did not run, that file is skipped rather than reported as a working FFprobe. It only locates the binary: no code from the user's packages is loaded. Env overrides,PATH,.hyperframes/binand the common install folders all still win, so machines with a system FFmpeg are unchanged.Verification
ffBinaries.test.tscases build a temporary project with an emptyPATHand a failingwhich: the hoisted ffmpeg and ffprobe packages are found (fail on the previous code); a pnpm-style layout, where the platform package sits next to the installer package and not in the project'snode_modules, is found (fails when only the project is searched); a non-executableffprobeis skipped (fails with a plain existence check; Unix only); a system binary in a common install folder wins over the installer package (fails when the installer lookup runs first). The tests hide the host's real install folders, so they pass on machines with FFmpeg installed.fallow auditare clean.Known limits
Yarn Plug'n'Play installs have no
node_modulesfolder and are not searched.@ffmpeg-installerships FFmpeg 4.1-era builds (the@ffprobe-installerpackages are newer 5.x builds). They render plain compositions, but variable-frame-rate video needs FFmpeg 5.1+ and fails withVIDEO_SOURCE_UNRENDERABLEon them; a preflight warning for an FFmpeg older than 5.1 follows in its own PR.On Linux and macOS, when install scripts are blocked (pnpm 10+ by default,
npm --ignore-scripts),@ffprobe-installerleavesffprobewithout the execute bit, so it is skipped and FFprobe is still reported missing; approving the package's build script (pnpm approve-builds) fixes it. Windows is unaffected.media-usehas its own FFmpeg lookup (env override orPATH) and does not use this resolver.The lookup starts from the current directory, as the
.hyperframes/binlookup does; running the CLI from outside the project does not find the project's package.Why this PR is small
It is a one-function change to the shared resolver with its test.