diegosouzapw/OmniRoute · error · Error
Video stream index is invalid
Error message
Video stream index is invalid
What it means
detectSceneChangeTimestamps validates options.streamIndex: it must be a non-negative integer (a valid ffprobe stream selector). A fractional or negative index means the caller passed unparsed metadata.
Solutions
- Pass Number(stream.index) from the ffprobe selection step, never the raw string
- Default to stream index 0 when no selection was made
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at src/lib/guardrails/videoBridgeRuntime.ts:606 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of diegosouzapw/OmniRoute@a179ffed5b (2026-08-25).
Data as JSON: /api/errors/69d3ac5970b82136.
Report an issue: GitHub.
Appendix: source
Thrown at src/lib/guardrails/videoBridgeRuntime.ts:606
...(focusWindow ? { focusWindow } : {}),
policyEffective: "scene_aware",
policyRequested: "scene_aware",
timestamps: selected,
};
}
export async function detectSceneChangeTimestamps(
inputPath: string,
options: {
durationSeconds: number;
runner?: VideoCommandRunner;
signal?: AbortSignal;
streamIndex: number;
timeoutMs?: number;
}
): Promise<number[]> {
assertLocalPath(inputPath);
if (!Number.isInteger(options.streamIndex) || options.streamIndex < 0) {
throw new Error("Video stream index is invalid");
}
const result = await (options.runner ?? defaultRunner)(
"ffmpeg",
[
"-nostdin",
"-hide_banner",
"-loglevel",
"info",
"-protocol_whitelist",
"file",
"-format_whitelist",
SAFE_FORMAT_WHITELIST,
"-threads",
"1",
"-i",
inputPath,
"-map",
`0:${options.streamIndex}`,View on GitHub (pinned to a179ffed5b)