From e06c329e40bc96da9fccec70a5e1f2af2ee5f282 Mon Sep 17 00:00:00 2001 From: yangxin317 <130425418+yangxin317@users.noreply.github.com> Date: Thu, 7 May 2026 22:13:49 +0800 Subject: [PATCH] fix(ffmpeg): drop non-primary audio streams to support iPhone spatial video iPhone 15 Pro+ records Spatial Video with two audio streams: a regular stereo AAC track plus an Apple Spatial Audio Codec (apac) track. ffmpeg has no codec tag for `apac` in the mp4 container, so a stream-copy that maps all audio streams during shot segmentation fails with: [mp4] Could not find tag for codec none in stream #2, codec not currently supported in container [out#0/segment] Could not write header (incorrect codec parameters?) The downstream LLM then receives the ffmpeg error text as the clip description and refuses to proceed, so the entire workflow stalls right after the first user message. Restrict the implicit audio mapping to the first audio stream (`0:a:0?`) so the apac stream is dropped during segmentation. The `?` suffix keeps the mapping optional for media without audio. Repro: upload an iPhone 15/16 Pro Spatial Video .mov and run any workflow that triggers `split_shots`. --- src/open_storyline/utils/ffmpeg_utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/open_storyline/utils/ffmpeg_utils.py b/src/open_storyline/utils/ffmpeg_utils.py index bf31f7d..ca592ae 100644 --- a/src/open_storyline/utils/ffmpeg_utils.py +++ b/src/open_storyline/utils/ffmpeg_utils.py @@ -20,7 +20,7 @@ FFMPEG_ENVIRONMENT_VARIABLE_KEYS = ("IMAGEIO_FFMPEG_EXE", "FFMPEG_BINARY") -SAFE_MAP_ARGS = ["-map", "0:v:0", "-map", "0:a?", "-dn", "-sn"] +SAFE_MAP_ARGS = ["-map", "0:v:0", "-map", "0:a:0?", "-dn", "-sn"] CLIP_ID_NUMBER_WIDTH = 4