From d4a2fe507fd2f176a5af0541f5fe868824a84223 Mon Sep 17 00:00:00 2001 From: wukko Date: Thu, 29 May 2025 00:23:56 +0600 Subject: [PATCH] web: add support for "remux" type of local processing it's currently used for fixing a very specific set of twitter videos, but will be used for remuxing HLS videos in the future --- docs/api.md | 2 +- web/src/lib/task-manager/queue.ts | 7 ++++--- web/src/lib/types/api.ts | 2 +- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/docs/api.md b/docs/api.md index 35744a2d..4949b3e0 100644 --- a/docs/api.md +++ b/docs/api.md @@ -112,7 +112,7 @@ the response will always be a JSON object containing the `status` key, which is | key | type | value | |:-------------|:-----------|:--------------------------------------------------------------| | `status` | `string` | `local-processing` | -| `type` | `string` | `merge`, `mute`, `audio`, or `gif` | +| `type` | `string` | `merge`, `mute`, `audio`, `gif`, or `remux` | | `service` | `string` | origin service (`youtube`, `twitter`, `instagram`, etc) | | `tunnel` | `string[]` | array of tunnel URLs | | `output` | `object` | details about the output file ([see below](#output-object)) | diff --git a/web/src/lib/task-manager/queue.ts b/web/src/lib/task-manager/queue.ts index 85852082..bd79269f 100644 --- a/web/src/lib/task-manager/queue.ts +++ b/web/src/lib/task-manager/queue.ts @@ -58,13 +58,14 @@ const mediaIcons: { [key: string]: CobaltPipelineResultFileType } = { merge: "video", mute: "video", audio: "audio", - gif: "image" + gif: "image", + remux: "video" } const makeRemuxArgs = (info: CobaltLocalProcessingResponse) => { const ffargs = ["-c:v", "copy"]; - if (info.type === "merge") { + if (["merge", "remux"].includes(info.type)) { ffargs.push("-c:a", "copy"); } else if (info.type === "mute") { ffargs.push("-an"); @@ -159,7 +160,7 @@ export const createSavePipeline = ( let ffargs: string[]; let workerType: 'encode' | 'remux'; - if (["merge", "mute"].includes(info.type)) { + if (["merge", "mute", "remux"].includes(info.type)) { workerType = "remux"; ffargs = makeRemuxArgs(info); } else if (info.type === "audio") { diff --git a/web/src/lib/types/api.ts b/web/src/lib/types/api.ts index e96833d6..6e030856 100644 --- a/web/src/lib/types/api.ts +++ b/web/src/lib/types/api.ts @@ -56,7 +56,7 @@ export type CobaltFileMetadata = Record< typeof CobaltFileMetadataKeys[number], string | undefined >; -export type CobaltLocalProcessingType = 'merge' | 'mute' | 'audio' | 'gif'; +export type CobaltLocalProcessingType = 'merge' | 'mute' | 'audio' | 'gif' | 'remux'; export type CobaltLocalProcessingResponse = { status: CobaltResponseType.LocalProcessing,