diff --git a/management/commands/generate_clips.py b/management/commands/generate_clips.py index 2a6a5ea..1f22450 100644 --- a/management/commands/generate_clips.py +++ b/management/commands/generate_clips.py @@ -57,7 +57,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 adc34e4..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 @@ -328,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)