agentleFS
heristopheristop/leclap/.agents/skills/cross-platform-ffmpeg/SKILL.md

cross-platform-ffmpeg

Skill35 starsChanged 14 days agoMITView on GitHub

Use when working with FFmpeg across Node/Static/WASM, the PlatformBridge, the FFmpeg detection/fallback chain, or browser/React Native runtime constraints in ffmpeg-video-composer.

The file

We split this skill into the rules it gives an agent

1 rule. About 0 are common, 0 are distinctive, and 1 is very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈0

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 1

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Use the filesystem adapter's fetch/staging helpers for assets.

    line 32

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Cross-Platform FFmpeg

Adapter wiring

Shared command builders use AbstractFFmpeg. The Node entry point uses PlatformBridge; the browser and React Native entry points register their own adapters directly. Do not route their bundles through PlatformBridge, which imports Node modules. Architecture: docs/architecture.md.

Entry pointFFmpegFilesystemLoggerMusic
src/index.ts (Node)FFmpegNodeAdapter or FFmpegStaticAdapterFilesystemNodeAdapterPinoLogAdapterMusicNodeAdapter
src/browser.tsFFmpegWasmAdapterBrowserFilesystemAdapter (IndexedDB)BrowserLoggerMusicWasmAdapter
src/reactnative.tsFFmpegDeviceAdapter (injected NativeEngine)FilesystemExpoAdapterReactNativeLoggerMusicFFmpegAdapter

Paths above are relative to packages/ffmpeg-video-composer/. FFmpeg and music adapters live in src/platform/ffmpeg/; filesystem adapters live in src/platform/filesystem/, and the Node logger lives in src/platform/logging/. The logger classes for browser/RN live in their entry points.

Detection and probing

FFmpegDetector.detect() tries system ffmpeg -version, then the ffmpeg-static binary. Both adapters use execFile with parseCommand argv, without a shell. System detection does not check ffprobe; FFmpegNodeAdapter.getInfos() expects ffprobe on PATH.

The detector also has a WASM branch, but detectWasmFFmpeg() refuses environments without window. It is not a working pure-Node fallback. Browser hosts use browser.ts directly. With no available backend, the Node bridge throws with installation instructions.

ffmpeg-static ships only FFmpeg. resolve-ffprobe.ts selects an existence-checked binary from the optional ffprobe-static package or beside the resolved FFmpeg binary. Without one, FFmpegStaticAdapter.probeUnavailableReason is set. director/render-needs.ts rejects probing templates before the first segment encodes: non-cut transitions, whole-video overlays, enabled/resolved music, and project_video sections. MusicNodeAdapter probes and loops through the selected adapter's binaries, preserving the static path.

Browser / WASM constraints

  • IndexedDB assets are copied into FFmpeg's separate in-memory MEMFS before commands, and outputs copied back (FFmpegWasmAdapter). IndexedDB quota does not increase WASM memory capacity; large inputs and intermediate copies can exhaust memory. Treat the approximate 2 GB WASM input ceiling as a limit, not a supported project size.
  • FFMPEG_CORE_VERSION and the default CDN loader live in src/platform/ffmpeg/ffmpeg-core.ts. Hosts can supply BrowserCompileOptions.loadFFmpegCore; keep the served core in sync with that pin.
  • Use the filesystem adapter's fetch/staging helpers for assets. Browser fonts must be bundled font IDs or readable TTF files; family-based Google font resolution is rejected (supportsRemoteFonts = false).
  • WASM progress goes through AbstractFFmpeg.progressListener using elapsed microseconds and the director's expected duration. The event manager carries compilation events. Web cancellation emits task-cancelled and stops at director checkpoints; it does not terminate an active WASM command.
  • WASM and device adapters keep supportsConcurrentExecute = false; Node/static support independent child processes. Use the explicit usesVirtualFilesystem / hasVirtualFilesystem capability rather than importing the WASM class into shared code.

Changes across runtimes

Keep imports from browser.ts browser-safe and imports from reactnative.ts free of Node/WASM worker dependencies. Add shared command features in managers/presets; extend adapter contracts only when execution actually needs a new capability. Validate the emitted filters against docs/runtime-capabilities.md and the device allowlist in scripts/ffmpeg/common.sh; a changed allowlist requires rebuilt native binaries. For native build and cancellation details, read docs/on-device-compilation.md and the ondevice-ffmpeg-engine skill.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.