Skip to content

Commit

Permalink
Allow und in language
Browse files Browse the repository at this point in the history
  • Loading branch information
matvp91 committed Dec 5, 2024
1 parent 5349a73 commit 6bd2a84
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
8 changes: 7 additions & 1 deletion packages/artisan/src/workers/ffprobe.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
};
}
Expand Down
4 changes: 2 additions & 2 deletions packages/artisan/src/workers/transcode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 6bd2a84

Please sign in to comment.