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 = [] selected_clips = []
tags = [] tags = []
while selected_clips_length < target: while selected_clips_length < target * 1.1:
if not tags: if not tags:
tags = fragment["tags"].copy() tags = fragment["tags"].copy()
tag = random_choice(seq, tags, pop=True) 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'] next_length = length + clip['duration']
if target - next_length < -target*0.1: if target - next_length < -target*0.1:
break break
length += int(clip['duration'] * fps) / fps clip_duration = int(clip['duration'] * fps) / fps
length += clip_duration
# 50/50 source or ai # 50/50 source or ai
src = clip['source'] src = clip['source']
audio = clip['source'] audio = clip['source']
# select ai if we have one # select ai if we have one
if 'ai' in clip: if 'ai' in clip and clip.get("use_ai"):
if clip["use_ai"]:
src = random_choice(seq, list(clip['ai'].values()), False) src = random_choice(seq, list(clip['ai'].values()), False)
print('%07.3f-%07.3f %07.3f %s (%s)' % ( print('%07.3f-%07.3f %07.3f %s (%s)' % (
length-clip['duration'], length-clip_duration,
length, length,
clip['duration'], clip['duration'],
os.path.basename(clip['source']), 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: if not clips:
print("not enough clips, also consider last clip") print("not enough clips, also consider last clip")
clips = all_clips.copy() clips = all_clips.copy()
for clip in clips:
if "ai" in clip:
clip["use_ai"] = True
scene_duration = int(get_scene_duration(scene) * fps) scene_duration = int(get_scene_duration(scene) * fps)
voice_overs = [] voice_overs = []