Open source input before frame pipe

This commit is contained in:
Victor Kuznetsov
2026-07-31 15:07:15 -07:00
parent 7818e60824
commit 9b9f9c6ced
3 changed files with 13 additions and 5 deletions
+4
View File
@@ -158,6 +158,10 @@ tail when diagnostics are unusually large. Aborts release it even when ffmpeg
has already exited. A real subprocess regression writes diagnostics beyond pipe
capacity while streaming frames, checks bounded failure reporting, and the Linux
full-clip CI job guards the complete path.
The finite source file is opened before the frame pipe, so ffmpeg can initialize
the copied audio stream before producer backpressure is possible. Stream and
metadata mappings are source-indexed accordingly; regressions assert the input
order and both map targets.
`probe_video_encode_profile` reads the first source video stream with ffprobe
and preserves the supported properties that survive the 8-bit BGR boundary:
`yuv420p`/`yuv422p`/`yuv444p` chroma sampling, recognized color tags, encoder
+5 -5
View File
@@ -358,21 +358,21 @@ def raw_video_command(
"-loglevel",
"error",
*(["-copyts"] if copy_input_timestamps else []),
*frame_input,
"-i",
str(source),
*frame_input,
"-map",
"0:v:0",
"1:v:0",
"-map",
"1:a?",
"0:a?",
*_video_codec_args(output.suffix.lower(), crf=crf, profile=profile),
*_profile_args(profile),
"-c:a",
"copy",
"-map_metadata",
"-1" if strip_metadata else "1",
"-1" if strip_metadata else "0",
"-map_chapters",
"-1" if strip_metadata else "1",
"-1" if strip_metadata else "0",
]
if timestamped_input:
command.extend(["-fps_mode", "passthrough"])
+4
View File
@@ -128,6 +128,10 @@ def test_encoder_command_discards_metadata_and_copies_audio(
"colorprim=bt709:transfer=bt709:colormatrix=bt709:range=limited"
)
assert "pipe:0" in command
assert command.index(str(source)) < command.index("pipe:0")
assert command[command.index("-map") + 1] == "1:v:0"
second_map = command.index("-map", command.index("-map") + 1)
assert command[second_map + 1] == "0:a?"
assert "-shortest" not in command