force re-render sound

This commit is contained in:
j 2026-01-29 12:11:30 +01:00
commit 2bd9200b0f
2 changed files with 8 additions and 4 deletions

View file

@ -13,6 +13,7 @@ class Command(BaseCommand):
def add_arguments(self, parser): def add_arguments(self, parser):
parser.add_argument('--debug', action='store_true', dest='debug', default=False, help='output more info') parser.add_argument('--debug', action='store_true', dest='debug', default=False, help='output more info')
parser.add_argument('--force', action='store_true', dest='force', default=False, help='force update')
def handle(self, **options): def handle(self, **options):
render_all(options) render_all(options)

View file

@ -1,4 +1,5 @@
import os import os
import shutil
import subprocess import subprocess
import ox import ox
@ -11,11 +12,11 @@ from .render import default_prefix as root
from .render import load_defaults from .render import load_defaults
def render_all(options): def render_all(options):
if os.path.exists(os.path.join(root, "render/forest-5.1.mp4")): if not options["force"] and os.path.exists(os.path.join(root, "render/forest-5.1.mp4")):
print("forest-5.1.mp4 exists, skipping") print("forest-5.1.mp4 exists, skipping")
else: else:
render_forest() render_forest()
if os.path.exists(os.path.join(root, "render/music-5.1.mp4")): if not options["force"] and os.path.exists(os.path.join(root, "render/music-5.1.mp4")):
print("music-5.1.mp4 exists, skipping") print("music-5.1.mp4 exists, skipping")
else: else:
render_music() render_music()
@ -81,11 +82,12 @@ def render_music():
"-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]", "-map", "[a]",
"-ar", "48000", "-ar", "48000",
"-c:a", "aac", "render/music-5.1.mp4" "-c:a", "aac", "render/music-5.1-new.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("render/music-5.1-new.mp4", "render/music-5.1.mp4")
for name in ( for name in (
"music.kdenlive", "music.kdenlive",
"music.wav", "music.wav",
@ -157,11 +159,12 @@ def render_forest():
"-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]", "-map", "[a]",
"-ar", "48000", "-ar", "48000",
"-c:a", "aac", "render/forest-5.1.mp4" "-c:a", "aac", "render/forest-5.1-new.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("render/forest-5.1-new.mp4", "render/forest-5.1.mp4")
for name in ( for name in (
"forest.kdenlive", "forest.kdenlive",
"forest.wav", "forest.wav",