feat: add heal cut ffmpeg command

This commit is contained in:
2026-07-04 20:14:19 +02:00
parent fec08cfcb3
commit 678f6e5cc4
2 changed files with 71 additions and 0 deletions
+36
View File
@@ -231,6 +231,42 @@ def test_audio_delete_empty_head():
assert "atrim=end=0.0" in fc and "atrim=start=2.0" in fc
def test_audio_heal_delete_command_crossfades_join():
from core.ffmpeg import build_audio_heal_delete_command
cmd = build_audio_heal_delete_command("/in.wav", 2.0, 4.0, "/o/o.wav", crossfade=0.1)
assert cmd[0] == "ffmpeg"
assert cmd.count("-i") == 1
fc = cmd[cmd.index("-filter_complex") + 1]
assert "atrim=end=2.0" in fc
assert "atrim=start=4.0" in fc
assert "acrossfade=d=0.1:c1=qsin:c2=qsin[out]" in fc
assert cmd[cmd.index("-map") + 1] == "[out]"
assert "pcm_s16le" in cmd
assert cmd[-1] == "/o/o.wav"
def test_audio_heal_delete_command_auto_crossfade_clamped():
from core.ffmpeg import build_audio_heal_delete_command
cmd = build_audio_heal_delete_command("/in.wav", 10.0, 12.0, "/o/o.mp3")
fc = cmd[cmd.index("-filter_complex") + 1]
assert "acrossfade=d=0.25:c1=qsin:c2=qsin[out]" in fc
assert "libmp3lame" in cmd
def test_audio_heal_delete_command_near_start_shortens_crossfade():
from core.ffmpeg import build_audio_heal_delete_command
cmd = build_audio_heal_delete_command("/in.wav", 0.03, 1.0, "/o/o.wav")
fc = cmd[cmd.index("-filter_complex") + 1]
assert "acrossfade=d=0.03:c1=qsin:c2=qsin[out]" in fc
def test_audio_heal_delete_command_rejects_invalid_region():
import pytest
from core.ffmpeg import build_audio_heal_delete_command
with pytest.raises(ValueError):
build_audio_heal_delete_command("/in.wav", 3.0, 3.0, "/o/o.wav")
# --- ProcessedDB ---
def test_db_add_and_get_markers():