Changeset 1f640ff in Klonkt for src/routes
- Timestamp:
- 07/30/2026 12:04:21 PM (6 weeks ago)
- Branches:
- main
- Children:
- f9b1c5c
- Parents:
- 6dd26e5
- File:
-
- 1 edited
-
src/routes/activitypub.js (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/routes/activitypub.js
r6dd26e5 r1f640ff 357 357 // audio-tegel op): ffmpeg draws the waveform into <name>.poster.png. 358 358 // White on transparent, so the tile's own gradient stays the backdrop 359 // and every audio post keeps its own hue. 359 // and every audio post keeps its own hue. The shape is bars, not the 360 // raw hairy wave (Robins tweede vraag): peak and average sampled into 361 // 57 columns (soft tip over bright core), blown up nearest-neighbor to 362 // 14px bars, and drawgrid ERASES 5px gaps (c=black@0 + replace=1 writes 363 // transparent pixels; h=2*ih keeps horizontal grid lines out of frame). 360 364 if (mime.startsWith('audio/')) { 361 365 Promise.all([import('child_process'), import('ffmpeg-static')]).then(([{ execFile }, ff]) => { … … 363 367 if (!bin) return; 364 368 const poster = req.file.path + '.poster.png'; 365 execFile(bin, ['-hide_banner', '-loglevel', 'error', '-y', '-i', req.file.path, '-filter_complex', 'showwavespic=s=800x256:colors=white', '-frames:v', '1', poster], 369 const graph = '[0:a]aformat=channel_layouts=mono,asplit[a][b];' 370 + '[a]showwavespic=s=57x256:colors=white@0.5:filter=peak:scale=sqrt:draw=full[pk];' 371 + '[b]showwavespic=s=57x256:colors=white:filter=average:scale=sqrt:draw=full[av];' 372 + '[pk][av]overlay=format=auto,scale=798:256:flags=neighbor,drawgrid=w=14:h=2*ih:t=5:c=black@0:replace=1'; 373 execFile(bin, ['-hide_banner', '-loglevel', 'error', '-y', '-i', req.file.path, '-filter_complex', graph, '-frames:v', '1', poster], 366 374 { timeout: 30000 }, (e) => { if (e && e.code !== 'ENOENT') console.warn('[media] waveform failed:', e.message); }); 367 375 }).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)