Compare commits

...

4 commits

Author SHA1 Message Date
j
3a367e8c73 handle animation clips 2023-10-28 11:25:45 +02:00
j
fee8e821f9 mixed output 2023-10-28 11:24:51 +02:00
j
b571bb2271 import handling 2023-10-28 11:24:43 +02:00
j
af8f7433c3 produce better seeking mp4 files 2023-10-22 11:18:03 +01:00
3 changed files with 22 additions and 6 deletions

View file

@ -43,6 +43,8 @@ class Command(BaseCommand):
clip['editingtags'] = i.data.get('editingtags', []) clip['editingtags'] = i.data.get('editingtags', [])
if "original" in clip and "foreground" in clip and "background" in clip: if "original" in clip and "foreground" in clip and "background" in clip:
clips.append(clip) clips.append(clip)
elif "original" in clip and "animation" in clip:
clips.append(clip)
else: else:
print("ignoring incomplete video", i) print("ignoring incomplete video", i)
@ -57,7 +59,7 @@ class Command(BaseCommand):
source = vo.files.filter(selected=True)[0] source = vo.files.filter(selected=True)[0]
batch = vo.get('batch')[0].replace('Text-', '') batch = vo.get('batch')[0].replace('Text-', '')
src = source.data.path 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) os.makedirs(os.path.dirname(target), exist_ok=True)
if os.path.islink(target): if os.path.islink(target):
os.unlink(target) os.unlink(target)

View file

@ -4,6 +4,7 @@ import os
import subprocess import subprocess
import sys import sys
import time import time
import shutil
from pathlib import Path from pathlib import Path
import ox import ox
@ -281,9 +282,13 @@ def render_all(options):
cmd = [ cmd = [
'xvfb-run', '-a', 'xvfb-run', '-a',
'melt', timeline, 'melt', timeline,
'-quiet',
'-consumer', 'avformat:%s' % timeline.replace('.kdenlive', ext), '-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) subprocess.call(cmd)
if ext == '.wav' and timeline.endswith('audio.kdenlive'): if ext == '.wav' and timeline.endswith('audio.kdenlive'):
cmd = [ 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]", "-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" "-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: for cmd in cmds:
#print(" ".join([str(x) for x in cmd])) #print(" ".join([str(x) for x in cmd]))
subprocess.call(cmd) subprocess.call(cmd)
''' shutil.move(fragment_prefix / "back-5.1.mp4", fragment_prefix / "back.mp4")
for fn in ( for fn in (
"audio-A1.wav", "audio-A2.wav", "audio-A3.wav", "audio-5.1.mp4", "fl.wav", "fr.wav", "fc.wav", "lfe.wav", "bl.wav", "br.wav",
"fl.wav", "fr.wav", "fc.wav", "lfe.wav", "bl.wav", "br.wav",
): ):
fn = fragment_prefix / fn fn = fragment_prefix / fn
if os.path.exists(fn): if os.path.exists(fn):
os.unlink(fn) os.unlink(fn)
'''
print("Duration - Target: %s Actual: %s" % (target_position, position)) print("Duration - Target: %s Actual: %s" % (target_position, position))
with open(_cache, "w") as fd: with open(_cache, "w") as fd:
json.dump(_CACHE, fd) json.dump(_CACHE, fd)

View file

@ -4,6 +4,7 @@ def upgrade_originals():
import item.models import item.models
import itemlist.models import itemlist.models
nt = itemlist.models.List.objects.get(name='No Type') 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): for i in nt.get_items(nt.user):
orig = item.models.Item.objects.get(data__title=i.get('title'), data__type=["Original"]) orig = item.models.Item.objects.get(data__title=i.get('title'), data__type=["Original"])
print(i, orig) print(i, orig)
@ -14,9 +15,11 @@ def upgrade_originals():
orig.make_poster() orig.make_poster()
i.data['type'] = ['Empty'] i.data['type'] = ['Empty']
i.save() i.save()
no.items.add(orig)
def remove_deselected_files(): def remove_deselected_files():
import itemlist.models
il = itemlist.models.List.objects.get(name='New Originals') il = itemlist.models.List.objects.get(name='New Originals')
for i in il.items.all(): for i in il.items.all():
changed = False changed = False