Changeset 79f00c5 in Klonkt
- Timestamp:
- 07/30/2026 08:02:16 AM (6 weeks ago)
- Branches:
- main
- Children:
- 15f1cb5
- Parents:
- 9ed940e
- File:
-
- 1 edited
-
src/routes/activitypub.js (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
src/routes/activitypub.js
r9ed940e r79f00c5 317 317 // fall back to extracting a frame natively. 318 318 if (mime.startsWith('video/')) { 319 import('child_process').then(({ execFile }) => { 319 // The bundled static build (ffmpeg-static) does the work, exactly like 320 // VideoCoverService and AudioTranscoder already do: Klonkt SHIPS its 321 // ffmpeg (Robins opmerking, 30-7), so nothing needs installing on any 322 // machine. Soft dependency + best-effort: absent stays silent, and 323 // FFMPEG_PATH can still override for an operator who wants a newer one. 324 Promise.all([import('child_process'), import('ffmpeg-static')]).then(([{ execFile }, ff]) => { 325 const bin = process.env.FFMPEG_PATH || ff.default; 326 if (!bin) return; 320 327 const poster = req.file.path + '.poster.jpg'; 321 // FFMPEG_PATH lets a static build in ~/bin do the work without a 322 // system install; unset means "whatever is on PATH", and neither is 323 // an error when absent. 324 execFile(process.env.FFMPEG_PATH || 'ffmpeg', ['-y', '-ss', '1', '-i', req.file.path, '-frames:v', '1', '-vf', "scale='min(640,iw)':-2", poster], 328 execFile(bin, ['-hide_banner', '-loglevel', 'error', '-y', '-ss', '1', '-i', req.file.path, '-frames:v', '1', '-vf', "scale='min(640,iw)':-2", poster], 325 329 { timeout: 30000 }, (e) => { if (e && e.code !== 'ENOENT') console.warn('[media] poster failed:', e.message); }); 326 330 }).catch(() => { /* never blocks the upload */ });
Note:
See TracChangeset
for help on using the changeset viewer.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)