audio titles: rewrite to canonical 'ENG - CODEC · CHANNELS', two-line pipeline card
Build and Push Docker Image / build (push) Successful in 59s

audio tracks now get a harmonized title on output (overriding any file
title like 'Audio Description' — review has already filtered out tracks
we don't want to keep). mono/stereo render numerically (1.0/2.0), matching
the .1-suffixed surround layouts. pipeline card rows become two-line so
long titles wrap instead of being clipped by the column.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-04-14 16:02:32 +02:00
parent 027ea498c3
commit 9cdc054c4b
4 changed files with 98 additions and 26 deletions
+36
View File
@@ -182,6 +182,42 @@ describe("buildCommand", () => {
expect(cmd).toContain("-metadata:s:a:2 language=und");
});
test("writes canonical 'ENG - CODEC · CHANNELS' title on every kept audio stream", () => {
const streams = [
stream({ id: 1, type: "Video", stream_index: 0 }),
stream({ id: 2, type: "Audio", stream_index: 1, codec: "ac3", channels: 6, language: "eng", title: "Audio Description" }),
stream({ id: 3, type: "Audio", stream_index: 2, codec: "dts", channels: 1, language: "deu" }),
stream({ id: 4, type: "Audio", stream_index: 3, codec: "aac", channels: 2, language: null }),
];
const decisions = [
decision({ stream_id: 1, action: "keep", target_index: 0 }),
decision({ stream_id: 2, action: "keep", target_index: 0 }),
decision({ stream_id: 3, action: "keep", target_index: 1 }),
decision({ stream_id: 4, action: "keep", target_index: 2 }),
];
const cmd = buildCommand(ITEM, streams, decisions);
// Original "Audio Description" title is replaced with the harmonized form.
expect(cmd).toContain("-metadata:s:a:0 title='ENG - AC3 · 5.1'");
// Mono renders as 1.0 (not the legacy "mono" string).
expect(cmd).toContain("-metadata:s:a:1 title='DEU - DTS · 1.0'");
// Stereo renders as 2.0.
expect(cmd).toContain("-metadata:s:a:2 title='AAC · 2.0'");
});
test("custom_title still overrides the auto-generated audio title", () => {
const streams = [
stream({ id: 1, type: "Video", stream_index: 0 }),
stream({ id: 2, type: "Audio", stream_index: 1, codec: "ac3", channels: 6, language: "eng" }),
];
const decisions = [
decision({ stream_id: 1, action: "keep", target_index: 0 }),
decision({ stream_id: 2, action: "keep", target_index: 0, custom_title: "Director's Cut" }),
];
const cmd = buildCommand(ITEM, streams, decisions);
expect(cmd).toContain("-metadata:s:a:0 title='Director'\\''s Cut'");
expect(cmd).not.toContain("ENG - AC3");
});
test("sets first kept audio as default, clears others", () => {
const streams = [
stream({ id: 1, type: "Video", stream_index: 0 }),