diff --git a/management/commands/generate_clips.py b/management/commands/generate_clips.py index 2a6a5ea..3b56c35 100644 --- a/management/commands/generate_clips.py +++ b/management/commands/generate_clips.py @@ -43,6 +43,8 @@ class Command(BaseCommand): clip['editingtags'] = i.data.get('editingtags', []) if "original" in clip and "foreground" in clip and "background" in clip: clips.append(clip) + elif "original" in clip and "animation" in clip: + clips.append(clip) else: print("ignoring incomplete video", i) @@ -57,7 +59,7 @@ class Command(BaseCommand): source = vo.files.filter(selected=True)[0] batch = vo.get('batch')[0].replace('Text-', '') src = source.data.path - target = os.path.join(prefix, 'voice_over', batch, '%s.wav' % fragment_id) + target = os.path.join(prefix, 'voice_over', batch, '%s.wav' % fragment_id) os.makedirs(os.path.dirname(target), exist_ok=True) if os.path.islink(target): os.unlink(target) diff --git a/render.py b/render.py index ee7f817..d3571e2 100644 --- a/render.py +++ b/render.py @@ -4,6 +4,7 @@ import os import subprocess import sys import time +import shutil from pathlib import Path import ox @@ -281,9 +282,13 @@ def render_all(options): cmd = [ 'xvfb-run', '-a', 'melt', timeline, + '-quiet', '-consumer', 'avformat:%s' % timeline.replace('.kdenlive', ext), - '-quiet' ] + if ext == '.wav': + cmd += ['vn=1'] + else: + cmd += ['an=1', 'vcodec=libx264', 'x264opts=keyint=1', 'crf=15'] subprocess.call(cmd) if ext == '.wav' and timeline.endswith('audio.kdenlive'): cmd = [ @@ -324,18 +329,24 @@ def render_all(options): "-filter_complex", "[0:a][1:a][2:a][3:a][4:a][5:a]amerge=inputs=6[a]", "-map", "[a]", "-c:a", "aac", fragment_prefix / "audio-5.1.mp4" ]) + cmds.append([ + "ffmpeg", "-y", + "-nostats", "-loglevel", "error", + "-i", fragment_prefix / "back.mp4", + "-i", fragment_prefix / "audio-5.1.mp4", + "-c", "copy", + fragment_prefix / "back-5.1.mp4", + ]) for cmd in cmds: #print(" ".join([str(x) for x in cmd])) subprocess.call(cmd) - ''' + shutil.move(fragment_prefix / "back-5.1.mp4", fragment_prefix / "back.mp4") for fn in ( - "audio-A1.wav", "audio-A2.wav", "audio-A3.wav", - "fl.wav", "fr.wav", "fc.wav", "lfe.wav", "bl.wav", "br.wav", + "audio-5.1.mp4", "fl.wav", "fr.wav", "fc.wav", "lfe.wav", "bl.wav", "br.wav", ): fn = fragment_prefix / fn if os.path.exists(fn): os.unlink(fn) - ''' print("Duration - Target: %s Actual: %s" % (target_position, position)) with open(_cache, "w") as fd: json.dump(_CACHE, fd) diff --git a/utils.py b/utils.py index 04c7a49..b6efc6d 100644 --- a/utils.py +++ b/utils.py @@ -4,6 +4,7 @@ def upgrade_originals(): import item.models import itemlist.models nt = itemlist.models.List.objects.get(name='No Type') + no = itemlist.models.List.objects.get(name='New Originals') for i in nt.get_items(nt.user): orig = item.models.Item.objects.get(data__title=i.get('title'), data__type=["Original"]) print(i, orig) @@ -14,9 +15,11 @@ def upgrade_originals(): orig.make_poster() i.data['type'] = ['Empty'] i.save() + no.items.add(orig) def remove_deselected_files(): + import itemlist.models il = itemlist.models.List.objects.get(name='New Originals') for i in il.items.all(): changed = False