From d10e8b401fa5c1e32b8b4142348b3ea68e31df03 Mon Sep 17 00:00:00 2001 From: lethliel Date: Wed, 21 Jun 2023 09:38:47 +0200 Subject: [PATCH] fixes handling of audiofiles. Now in the __init__.py of the projects a audiofile can be given to the Rendertask: For example: queue.put(Rendertask( infile = 'intro.svg', audiofile = 'intro.mpg', outfile = str(event['id'])+".ts", sequence = introFrames, parameters = { '$ID': event['id'], '$TITLE': event['title'], '$SUBTITLE': event['subtitle'], '$SPEAKER': event['personnames'] } )) --- make.py | 2 ++ renderlib.py | 11 +++++++---- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/make.py b/make.py index 6c0834c..2553177 100755 --- a/make.py +++ b/make.py @@ -181,6 +181,8 @@ def worker(): # prepend workdir to input file task.infile = os.path.join(workdir, task.infile) + if task.audiofile: + task.audiofile = os.path.join(workdir, task.audiofile) task.outfile = os.path.join(outdir, task.outfile) task.workdir = workdir diff --git a/renderlib.py b/renderlib.py index b84ef75..823149c 100644 --- a/renderlib.py +++ b/renderlib.py @@ -35,13 +35,16 @@ def easeDelay(easer, delay, t, b, c, d, *args): class Rendertask: - def __init__(self, infile, parameters={}, outfile=None, workdir='.', sequence=None): + def __init__(self, infile, audiofile=None, parameters={}, outfile=None, workdir='.', sequence=None): if isinstance(infile, list): self.infile = infile[0] - # self.audiofile = infile[1] + self.audiofile = infile[1] else: self.infile = infile - self.audiofile = None + if audiofile: + self.audiofile = audiofile + else: + self.audiofile = None self.parameters = parameters self.outfile = outfile self.workdir = workdir @@ -188,7 +191,7 @@ def rendertask_video(task): if task.audiofile is None: cmd += '-map 1:0 -map 2:0 ' else: - cmd += '-map 1:0 -c:a copy -map 2:0 -c:a copy ' + cmd += '-map 1:a -c:a copy -map 2:a -c:a copy ' cmd += '-shortest -f mpegts "{0}"'.format(task.outfile) elif task.outfile.endswith('.mov'): cmd = 'cd {0} && '.format(task.workdir)