render fixes

This commit is contained in:
j 2026-01-25 20:18:10 +01:00
commit 4b3b225a2c

View file

@ -84,7 +84,7 @@ def compose(clips, fragment, target=150, base=1024, voice_over=None, options=Non
selected_clips = []
tags = []
while selected_clips_length < target:
while selected_clips_length < target * 1.1:
if not tags:
tags = fragment["tags"].copy()
tag = random_choice(seq, tags, pop=True)
@ -132,18 +132,18 @@ def compose(clips, fragment, target=150, base=1024, voice_over=None, options=Non
next_length = length + clip['duration']
if target - next_length < -target*0.1:
break
length += int(clip['duration'] * fps) / fps
clip_duration = int(clip['duration'] * fps) / fps
length += clip_duration
# 50/50 source or ai
src = clip['source']
audio = clip['source']
# select ai if we have one
if 'ai' in clip:
if clip["use_ai"]:
src = random_choice(seq, list(clip['ai'].values()), False)
if 'ai' in clip and clip.get("use_ai"):
src = random_choice(seq, list(clip['ai'].values()), False)
print('%07.3f-%07.3f %07.3f %s (%s)' % (
length-clip['duration'],
length-clip_duration,
length,
clip['duration'],
os.path.basename(clip['source']),
@ -196,6 +196,9 @@ def compose(clips, fragment, target=150, base=1024, voice_over=None, options=Non
if not clips:
print("not enough clips, also consider last clip")
clips = all_clips.copy()
for clip in clips:
if "ai" in clip:
clip["use_ai"] = True
scene_duration = int(get_scene_duration(scene) * fps)
voice_overs = []