diff --git a/packages/artisan/src/workers/ffprobe.ts b/packages/artisan/src/workers/ffprobe.ts index 9ba79a00..20519485 100644 --- a/packages/artisan/src/workers/ffprobe.ts +++ b/packages/artisan/src/workers/ffprobe.ts @@ -34,8 +34,14 @@ export const ffprobeCallback: WorkerCallback< const stream = info.streams.find( (stream) => stream.codec_type === "audio", ); + + let language = info.format.tags?.["language"]; + if (!language || typeof language === "number") { + language = undefined; + } + result.audio[input.path] = { - language: info.format.tags?.["language"] as string, + language, channels: stream?.channels, }; } diff --git a/packages/artisan/src/workers/transcode.ts b/packages/artisan/src/workers/transcode.ts index 8edf0674..cbdd648f 100644 --- a/packages/artisan/src/workers/transcode.ts +++ b/packages/artisan/src/workers/transcode.ts @@ -323,8 +323,8 @@ export function mergeInput( const info = probeResult.audio[partial.path]; assert(info); - const language = partial.language ?? getLangCode(info.language); - assert(language, defaultReason("audio", "language")); + // Get the language code, if not found, we fallback to undecided. + const language = partial.language ?? getLangCode(info.language) ?? "und"; // Assume when no channel metadata is found, we'll fallback to 2. const channels = partial.channels ?? info.channels ?? 2;