diff --git a/management/commands/render.py b/management/commands/render.py index b4a242c..ba477f0 100644 --- a/management/commands/render.py +++ b/management/commands/render.py @@ -16,6 +16,7 @@ class Command(BaseCommand): parser.add_argument('--duration', action='store', dest='duration', default="3600", help='target duration of all fragments in seconds') parser.add_argument('--offset', action='store', dest='offset', default="1024", help='inital offset in pi') parser.add_argument('--no-video', action='store_true', dest='no_video', default=False, help='don\'t render video') + parser.add_argument('--chapter', action='store', dest='chapter', default=None, help='chapter') parser.add_argument('--single-file', action='store_true', dest='single_file', default=False, help='render to single video') parser.add_argument('--keep-audio', action='store_true', dest='keep_audio', default=False, help='keep independent audio tracks') parser.add_argument('--stereo-downmix', action='store_true', dest='stereo_downmix', default=False, help='stereo downmix') diff --git a/render.py b/render.py index 22a2811..6067ea4 100644 --- a/render.py +++ b/render.py @@ -147,16 +147,17 @@ def compose(clips, target=150, base=1024, voice_over=None, options=None): clips = all_clips.copy() if length + clip['duration'] > target and length >= vo_min: break - print('%06.3f %06.3f' % (length, clip['duration']), os.path.basename(clip['original'])) length += int(clip['duration'] * fps) / fps # 50/50 original or ai src = clip['original'] audio = clip['original'] - # select ai... + # select ai if we have one if 'ai' in clip: - if chance(seq, 0.5): - src = random_choice(seq, clip['ai'].values(), False) + if True or chance(seq, 0.5): + src = random_choice(seq, list(clip['ai'].values()), False) + + print('%07.3f %07.3f' % (length, clip['duration']), src.split('/')[-2], os.path.basename(clip['original'])) scene['front']['V2'].append({ 'duration': clip['duration'], @@ -348,6 +349,8 @@ def render_all(options): for fragment in fragments: fragment_base += 1 fragment_id = int(fragment['name'].split(' ')[0]) + if options["chapter"] and int(options["chapter"]) != fragment_id: + continue name = fragment['name'].replace(' ', '_') if fragment_id < 10: name = '0' + name @@ -404,7 +407,7 @@ def render_all(options): cmd += ['vn=1'] else: cmd += ['an=1'] - cmd += ['vcodec=libx264', 'x264opts=keyint=1', 'crf=15'] + #cmd += ['vcodec=libx264', 'x264opts=keyint=1', 'crf=15'] subprocess.call(cmd) if ext == '.wav' and timeline.endswith('audio.kdenlive'): cmd = [