feat: add build_mask_output_dir utility
This commit is contained in:
@@ -63,6 +63,12 @@ def build_ffmpeg_command(
|
||||
return cmd
|
||||
|
||||
|
||||
def build_mask_output_dir(video_path: str) -> str:
|
||||
"""Return path of mask output directory: <stem>_masks/ next to the video."""
|
||||
p = Path(video_path)
|
||||
return str(p.parent / f"{p.stem}_masks")
|
||||
|
||||
|
||||
_RATIOS: dict[str, tuple[int, int]] = {
|
||||
"9:16": (9, 16),
|
||||
"4:5": (4, 5),
|
||||
|
||||
+10
-1
@@ -1,5 +1,5 @@
|
||||
import tempfile, os
|
||||
from main import build_export_path, format_time, build_ffmpeg_command
|
||||
from main import build_export_path, format_time, build_ffmpeg_command, build_mask_output_dir
|
||||
from main import _normalize_filename, ProcessedDB
|
||||
|
||||
|
||||
@@ -173,3 +173,12 @@ def test_ffmpeg_command_portrait_and_resize():
|
||||
def test_ffmpeg_command_portrait_off():
|
||||
cmd = build_ffmpeg_command("/in/video.mp4", 0.0, "/out/clip.mp4")
|
||||
assert "-vf" not in cmd
|
||||
|
||||
def test_mask_output_dir_basic():
|
||||
assert build_mask_output_dir("/out/clip_001.mp4") == "/out/clip_001_masks"
|
||||
|
||||
def test_mask_output_dir_mkv():
|
||||
assert build_mask_output_dir("/out/my_clip.mkv") == "/out/my_clip_masks"
|
||||
|
||||
def test_mask_output_dir_nested():
|
||||
assert build_mask_output_dir("/a/b/c/shot_042.mp4") == "/a/b/c/shot_042_masks"
|
||||
|
||||
Reference in New Issue
Block a user