Skip to content

best way to save what you love

web/queue: add audio covers & crop them when needed

wukkoe4ce873b565f
diff --git a/web/src/lib/task-manager/queue.ts b/web/src/lib/task-manager/queue.ts
index 7b507426..73ced4d4 100644
--- a/web/src/lib/task-manager/queue.ts
+++ b/web/src/lib/task-manager/queue.ts
@@ -82,11 +82,27 @@ const makeAudioArgs = (info: CobaltLocalProcessingResponse) => {
return;
}
- const ffargs = [
- "-vn",
+ const ffargs = [];
+
+ if (info.audio.cover) {
+ ffargs.push(
+ "-map", "0",
+ "-map", "1",
+ ...(info.audio.cropCover ? [
+ "-c:v", "mjpeg",
+ "-vf", "scale=-1:800,crop=800:800",
+ ] : [
+ "-c:v", "copy",
+ ]),
+ );
+ } else {
+ ffargs.push("-vn");
+ }
+
+ ffargs.push(
...(info.audio.copy ? ["-c:a", "copy"] : ["-b:a", `${info.audio.bitrate}k`]),
...(info.output.metadata ? ffmpegMetadataArgs(info.output.metadata) : [])
- ];
+ );
if (info.audio.format === "mp3" && info.audio.bitrate === "8") {
ffargs.push("-ar", "12000");
diff --git a/web/src/lib/types/api.ts b/web/src/lib/types/api.ts
index 2091a8e2..f127d02e 100644
--- a/web/src/lib/types/api.ts
+++ b/web/src/lib/types/api.ts
@@ -80,6 +80,8 @@ export type CobaltLocalProcessingResponse = {
copy: boolean,
format: string,
bitrate: string,
+ cover?: boolean,
+ cropCover?: boolean,
},
isHLS?: boolean,