Mask timecode in phase refine and guard cutter scene starts

This commit is contained in:
Melbar
2026-05-08 14:18:27 +02:00
parent bdc9e4ab31
commit e335fffe92
7 changed files with 26 additions and 11 deletions
+15 -6
View File
@@ -120,6 +120,7 @@ STILL_WIDTH = 480
STILL_QUALITY = 4
CLIP_WIDTH = 480
CLIP_MAX_DURATION_S = 30.0
SCENE_START_GUARD_S = 0.32
# Each half of the side-by-side compare strip
COMPARE_HALF_W = 480
COMPARE_H = 270 # 16:9
@@ -423,18 +424,26 @@ def collect_rows(
num_segs = len(segs)
if scenes_by_id:
rec_scene = scenes_by_id.get(int(rec.get("scene_id", -1)))
if rec_scene and float(rec["in_point_s"]) < float(rec_scene["start_s"]):
shift = float(rec_scene["start_s"]) - float(rec["in_point_s"])
if rec_scene and float(rec["in_point_s"]) < float(rec_scene["start_s"]) + SCENE_START_GUARD_S:
guarded_start = min(
float(rec_scene["end_s"]) - 0.04,
float(rec_scene["start_s"]) + SCENE_START_GUARD_S,
)
shift = guarded_start - float(rec["in_point_s"])
rec = dict(rec)
rec["in_point_s"] = float(rec_scene["start_s"])
rec["in_point_s"] = guarded_start
rec["out_point_s"] = max(float(rec["in_point_s"]) + 0.04, float(rec["out_point_s"]) + shift)
fixed_segs = []
for seg in segs:
fixed = dict(seg)
seg_scene = scenes_by_id.get(int(fixed.get("scene_id", -1)))
if seg_scene and float(fixed["in_point_s"]) < float(seg_scene["start_s"]):
shift = float(seg_scene["start_s"]) - float(fixed["in_point_s"])
fixed["in_point_s"] = float(seg_scene["start_s"])
if seg_scene and float(fixed["in_point_s"]) < float(seg_scene["start_s"]) + SCENE_START_GUARD_S:
guarded_start = min(
float(seg_scene["end_s"]) - 0.04,
float(seg_scene["start_s"]) + SCENE_START_GUARD_S,
)
shift = guarded_start - float(fixed["in_point_s"])
fixed["in_point_s"] = guarded_start
fixed["out_point_s"] = max(float(fixed["in_point_s"]) + 0.04, float(fixed["out_point_s"]) + shift)
fixed_segs.append(fixed)
segs = fixed_segs