feat(pipeline): crossfade seamless-loop arg builder (content pipeline §3.3)

This commit is contained in:
BenStullsBets
2026-06-24 07:54:01 -07:00
parent 642451925f
commit 7217daeb44
2 changed files with 42 additions and 1 deletions
+19 -1
View File
@@ -1,4 +1,4 @@
from tools.pipeline.ffmpeg_ops import frame_args
from tools.pipeline.ffmpeg_ops import frame_args, crossfade_loop_args
def test_frame_args_trims_scales_pads_and_strips_audio():
@@ -15,3 +15,21 @@ def test_frame_args_trims_scales_pads_and_strips_audio():
assert "pad=1920:1080" in vf
assert "format=yuv420p" in vf
assert args[-1] == "out.mp4"
def test_crossfade_loop_builds_head_mid_tail_xfade_concat():
args = crossfade_loop_args("in.mp4", "loop.mp4", duration=8.0, overlap=1.0)
fc = args[args.index("-filter_complex") + 1]
assert "trim=0:1.0" in fc # head = first O secs
assert "trim=1.0:7.0" in fc # mid = [O, D-O]
assert "trim=7.0:8.0" in fc # tail = last O secs
assert "xfade=transition=fade:duration=1.0:offset=0" in fc
assert "concat=n=2:v=1" in fc
assert "-an" in args
assert args[-1] == "loop.mp4"
def test_crossfade_loop_rejects_overlap_too_large():
import pytest
with pytest.raises(ValueError):
crossfade_loop_args("in.mp4", "loop.mp4", duration=4.0, overlap=2.0)