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():
|
def debug():
|
||||||
render(
|
render(
|
||||||
"intro.svg",
|
["intro.svg", "intro.flac"],
|
||||||
"../intro.ts",
|
"../intro.ts",
|
||||||
introFrames,
|
introFrames,
|
||||||
{
|
{
|
||||||
|
@ -181,7 +181,7 @@ def tasks(queue, args, idlist, skiplist):
|
||||||
# generate a task description and put it into the queue
|
# generate a task description and put it into the queue
|
||||||
queue.put(
|
queue.put(
|
||||||
Rendertask(
|
Rendertask(
|
||||||
infile="intro.svg",
|
infile=["intro.svg", "intro.flac"],
|
||||||
outfile=str(event["id"]) + ".ts",
|
outfile=str(event["id"]) + ".ts",
|
||||||
sequence=introFrames,
|
sequence=introFrames,
|
||||||
parameters={
|
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):
|
def __init__(self, infile, parameters={}, outfile=None, workdir='.', sequence=None):
|
||||||
if isinstance(infile, list):
|
if isinstance(infile, list):
|
||||||
self.infile = infile[0]
|
self.infile = infile[0]
|
||||||
# self.audiofile = infile[1]
|
self.audiofile = infile[1]
|
||||||
|
print(f"using audio file {self.audiofile}")
|
||||||
else:
|
else:
|
||||||
self.infile = infile
|
self.infile = infile
|
||||||
self.audiofile = None
|
self.audiofile = None
|
||||||
|
@ -200,16 +201,12 @@ def rendertask_video(task):
|
||||||
cmd = 'cd {0} && '.format(task.workdir)
|
cmd = 'cd {0} && '.format(task.workdir)
|
||||||
cmd += 'ffmpeg -f image2 -i .frames/%04d.png '
|
cmd += 'ffmpeg -f image2 -i .frames/%04d.png '
|
||||||
if task.audiofile is None:
|
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:
|
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)
|
cmd += '-shortest -f mpegts "{0}"'.format(task.outfile)
|
||||||
elif task.outfile.endswith('.mov'):
|
elif task.outfile.endswith('.mov'):
|
||||||
cmd = 'cd {0} && '.format(task.workdir)
|
cmd = 'cd {0} && '.format(task.workdir)
|
||||||
|
|
Loading…
Add table
Reference in a new issue