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
This commit is contained in:
wukko
2025-05-29 00:23:56 +06:00
parent bc8dcd5a97
commit d4a2fe507f
3 changed files with 6 additions and 5 deletions

View File

@ -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)) |

View File

@ -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") {

View File

@ -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,