feat(ffmpeg): add server-side FFmpeg media-processing block#4802
feat(ffmpeg): add server-side FFmpeg media-processing block#4802waleedlatif1 wants to merge 3 commits into
Conversation
Add an FFmpeg block that processes video/audio files server-side (no external service or auth) via an internal /api/tools/ffmpeg/process route. Files flow in and out as standard UserFile objects. Operations: convert, extract audio, trim, compress/scale, probe, thumbnail, concatenate, adjust volume, change speed.
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
PR SummaryMedium Risk Overview A new authenticated The block is registered with icons, docs ( Reviewed by Cursor Bugbot for commit 52323f6. Configure here. |
Greptile SummaryThis PR adds a server-side FFmpeg block supporting 9 operations (convert, extract audio, trim, compress, probe, thumbnail, concat, volume, speed), routed through
Confidence Score: 4/5Safe to merge after adding a minimum bound to the The speed contract field has apps/sim/lib/api/contracts/tools/media/ffmpeg.ts — the Important Files Changed
Reviews (2): Last reviewed commit: "fix(ffmpeg): guard concat output size, v..." | Re-trigger Greptile |
… ffprobe errors - Route concat output through finalize() so it enforces the empty-file and 200 MB output-size checks like every other operation - Validate scale (width:height) and volume (multiplier/dB) against strict patterns before interpolating into the filter graph (prevents filter injection) - Default compress audio to -c:a copy so audio isn't silently re-encoded - Surface a clear 'ffprobe not found' message and document that Change Speed also requires ffprobe
|
@greptile |
|
@cursor review |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 52323f6. Configure here.
- Sanitize all temp-file extensions (input name/MIME and output format) to [a-z0-9] so a crafted format like ../../../t.jpg cannot escape the temp dir (path traversal) - finalize() now checks output size via fs.stat before fs.readFile, so an oversized output is rejected without loading the whole file into memory - Bound the speed multiplier to [0.1, 100] in the contract (and block) to prevent tiny values producing pathologically large outputs

Summary
/api/tools/ffmpeg/processroute using the already-bundledffmpeg-static/fluent-ffmpeg.UserFileobjects (input via the STT pattern, output via the TTS pattern), so the block chains naturally with other blocks.lib/api/contracts/tools/media/ffmpeg.ts; block + 9 tools registered; icon + docs (with a manual usage section) added.Type of Change
Testing
Tested manually.
biomeclean,bun run check:api-validationpassing. Note:tsc/vitestwere not run locally (deps not installed in this workspace) — they run in CI.Notes
ffprobeon the server PATH (ffmpeg-staticbundles ffmpeg only) — same assumption as the existing audio extractor.Checklist