only create 5.1 mix once
This commit is contained in:
parent
b1ca39ff2b
commit
e0b157de64
1 changed files with 35 additions and 20 deletions
55
render.py
55
render.py
|
@ -90,6 +90,10 @@ def compose(clips, target=150, base=1024, voice_over=None):
|
|||
length += clip['duration']
|
||||
|
||||
fg = clip['foreground']
|
||||
if 'foley' in clip:
|
||||
foley = clip['foley']
|
||||
else:
|
||||
foley = fg
|
||||
if 'foreground2' in clip:
|
||||
if chance(seq, 0.5):
|
||||
fg = clip['foreground2']
|
||||
|
@ -140,9 +144,10 @@ def compose(clips, target=150, base=1024, voice_over=None):
|
|||
'duration': clip['duration'],
|
||||
'src': clip['original'],
|
||||
})
|
||||
# TBD: Foley
|
||||
scene['audio']['A2'].append({
|
||||
'duration': clip['duration'],
|
||||
'src': fg,
|
||||
'src': foley,
|
||||
})
|
||||
|
||||
return scene
|
||||
|
@ -286,33 +291,43 @@ def render_all(options):
|
|||
fragment_prefix = Path(fragment_prefix)
|
||||
cmds = []
|
||||
for src, out1, out2 in (
|
||||
('audio-A1.wav', 'fl.wav', 'fr.wav'),
|
||||
('audio-A2.wav', 'fc.wav', 'lfe.wav'),
|
||||
('audio-A3.wav', 'bl.wav', 'br.wav'),
|
||||
("audio-A1.wav", "fl.wav", "fr.wav"),
|
||||
("audio-A2.wav", "fc.wav", "lfe.wav"),
|
||||
("audio-A3.wav", "bl.wav", "br.wav"),
|
||||
):
|
||||
cmds.append([
|
||||
'ffmpeg', '-y',
|
||||
'-nostats', '-loglevel', 'error',
|
||||
'-i', fragment_prefix / src,
|
||||
'-filter_complex',
|
||||
"ffmpeg", "-y",
|
||||
"-nostats", "-loglevel", "error",
|
||||
"-i", fragment_prefix / src,
|
||||
"-filter_complex",
|
||||
"[0:0]pan=1|c0=c0[left]; [0:0]pan=1|c0=c1[right]",
|
||||
"-map", "[left]", fragment_prefix / out1,
|
||||
"-map", "[right]", fragment_prefix / out2,
|
||||
])
|
||||
cmds.append([
|
||||
'ffmpeg', '-y',
|
||||
'-nostats', '-loglevel', 'error',
|
||||
'-i', fragment_prefix / "fl.wav",
|
||||
'-i', fragment_prefix / "fr.wav",
|
||||
'-i', fragment_prefix / "fc.wav",
|
||||
'-i', fragment_prefix / "lfe.wav",
|
||||
'-i', fragment_prefix / "bl.wav",
|
||||
'-i', fragment_prefix / "br.wav",
|
||||
'-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 / "fl.wav",
|
||||
"-i", fragment_prefix / "fr.wav",
|
||||
"-i", fragment_prefix / "fc.wav",
|
||||
"-i", fragment_prefix / "lfe.wav",
|
||||
"-i", fragment_prefix / "bl.wav",
|
||||
"-i", fragment_prefix / "br.wav",
|
||||
"-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"
|
||||
])
|
||||
for cmd in cmds:
|
||||
#print(" ".join([str(x) for x in cmd]))
|
||||
subprocess.call(cmd)
|
||||
'''
|
||||
for fn in (
|
||||
"audio-A1.wav", "audio-A2.wav", "audio-A3.wav",
|
||||
"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)
|
||||
|
|
Loading…
Reference in a new issue