diff --git a/render.py b/render.py index 9bc19cd..4af4449 100644 --- a/render.py +++ b/render.py @@ -81,12 +81,13 @@ def compose(clips, target=150, base=1024, voice_over=None): vo_min = sum([vo['duration'] for vo in voice_overs]) if vo_min > target: target = vo_min - if vo_min < target: + elif vo_min < target: offset = (target - vo_min) / 2 scene['audio']['A3'].append({ 'blank': True, 'duration': offset }) + vo_min += offset for vo in voice_overs: scene['audio']['A3'].append(vo) @@ -105,7 +106,8 @@ def compose(clips, target=150, base=1024, voice_over=None): clips = [c for c in all_clips if c != clip] if not clips: clips = all_clips.copy() - if length + clip['duration'] > target: + print(clip['duration'], clip['original'], target, length, len(clips)) + if length + clip['duration'] > target and length >= vo_min: break length += clip['duration']