Encode jukebox audio with native ffmpeg, normalise loudness, read metadata
- Play every track through an ffmpeg process that normalises loudness (EBU R128) and outputs Ogg Opus, handed to Discord as is: no more Opus encoding in JavaScript with opusscript. Measured at over 40x real time, about 2% of a core while playing. Closing the stream kills ffmpeg. - Encoding at upload instead was ruled out: over two minutes for an 85-minute mix, during which the upload would hang. - Read duration, title and artist with ffprobe at upload; default the title to "Artist - Title" or the file name without extension. - Fill the duration of existing library entries at startup. - Expose the position of the current track in queue snapshots. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
d200040691
commit
98f4d29ac7
9 changed files with 309 additions and 22 deletions
|
|
@ -14,6 +14,7 @@ import { notificationsRouter } from "./routes/notifications.js";
|
|||
import { playerRouter } from "./routes/player.js";
|
||||
import { queueRouter } from "./routes/queue.js";
|
||||
import { uploadsRouter } from "./routes/uploads.js";
|
||||
import { backfillLibraryMetadata } from "./storage/libraryMetadata.js";
|
||||
import {
|
||||
cleanupTemporaryFiles,
|
||||
ensureStorageLayout,
|
||||
|
|
@ -120,6 +121,17 @@ function startWebServer(dependencies) {
|
|||
const cleanupInterval = setInterval(cleanup, TEMP_CLEANUP_INTERVAL);
|
||||
cleanupInterval.unref();
|
||||
|
||||
backfillLibraryMetadata()
|
||||
.then((updated) => {
|
||||
if (updated.length > 0) {
|
||||
console.log(
|
||||
`[${new Date().toLocaleString()}] Library metadata completed for ${updated.length} track(s)`
|
||||
);
|
||||
dependencies.queue.emit("libraryUpdate");
|
||||
}
|
||||
})
|
||||
.catch((error) => console.error("Unable to complete library metadata", error));
|
||||
|
||||
const app = createApp(dependencies);
|
||||
const port = Number(process.env.PORT || config.webServerPort || 3000);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue