add (& fix) audio rendering
This commit is contained in:
parent
be59f3ad69
commit
9712c37e9c
3 changed files with 7 additions and 10 deletions
|
@ -146,7 +146,7 @@ def outroFrames(args):
|
|||
|
||||
def debug():
|
||||
render(
|
||||
"intro.svg",
|
||||
["intro.svg", "intro.flac"],
|
||||
"../intro.ts",
|
||||
introFrames,
|
||||
{
|
||||
|
@ -181,7 +181,7 @@ def tasks(queue, args, idlist, skiplist):
|
|||
# generate a task description and put it into the queue
|
||||
queue.put(
|
||||
Rendertask(
|
||||
infile="intro.svg",
|
||||
infile=["intro.svg", "intro.flac"],
|
||||
outfile=str(event["id"]) + ".ts",
|
||||
sequence=introFrames,
|
||||
parameters={
|
||||
|
|
BIN
fsck2025/artwork/intro.flac
Normal file
BIN
fsck2025/artwork/intro.flac
Normal file
Binary file not shown.
13
renderlib.py
13
renderlib.py
|
@ -41,7 +41,8 @@ class Rendertask:
|
|||
def __init__(self, infile, parameters={}, outfile=None, workdir='.', sequence=None):
|
||||
if isinstance(infile, list):
|
||||
self.infile = infile[0]
|
||||
# self.audiofile = infile[1]
|
||||
self.audiofile = infile[1]
|
||||
print(f"using audio file {self.audiofile}")
|
||||
else:
|
||||
self.infile = infile
|
||||
self.audiofile = None
|
||||
|
@ -200,16 +201,12 @@ def rendertask_video(task):
|
|||
cmd = 'cd {0} && '.format(task.workdir)
|
||||
cmd += 'ffmpeg -f image2 -i .frames/%04d.png '
|
||||
if task.audiofile is None:
|
||||
cmd += '-ar 48000 -ac 1 -f s16le -i /dev/zero -ar 48000 -ac 1 -f s16le -i /dev/zero '
|
||||
cmd += '-ar 48000 -ac 1 -f s16le -i /dev/zero '
|
||||
else:
|
||||
cmd += '-i {0} -i {0} '.format(task.audiofile)
|
||||
cmd += '-i {0} '.format(task.audiofile)
|
||||
|
||||
cmd += '-map 0:0 -c:v mpeg2video -q:v 2 -aspect 16:9 '
|
||||
cmd += '-map 0:0 -c:v mpeg2video -q:v 2 -aspect 16:9 -map 1:a '
|
||||
|
||||
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 += '-shortest -f mpegts "{0}"'.format(task.outfile)
|
||||
elif task.outfile.endswith('.mov'):
|
||||
cmd = 'cd {0} && '.format(task.workdir)
|
||||
|
|
Loading…
Add table
Reference in a new issue