new mix
This commit is contained in:
parent
c786f22ed3
commit
7368316f8d
2 changed files with 47 additions and 15 deletions
49
render.py
49
render.py
|
@ -56,13 +56,23 @@ def compose(clips, target=150, base=1024, voice_over=None):
|
|||
'back': {
|
||||
'V1': [],
|
||||
'V2': [],
|
||||
'A1': [],
|
||||
},
|
||||
'audio': {
|
||||
'audio-center': {
|
||||
'A1': [],
|
||||
},
|
||||
'audio-front': {
|
||||
'A1': [],
|
||||
'A2': [],
|
||||
'A3': [],
|
||||
'A4': [],
|
||||
}
|
||||
},
|
||||
'audio-rear': {
|
||||
'A1': [],
|
||||
'A2': [],
|
||||
'A3': [],
|
||||
'A4': [],
|
||||
},
|
||||
}
|
||||
all_clips = clips.copy()
|
||||
seq = random(base)
|
||||
|
@ -85,13 +95,20 @@ def compose(clips, target=150, base=1024, voice_over=None):
|
|||
target = vo_min
|
||||
elif vo_min < target:
|
||||
offset = (target - vo_min) / 2
|
||||
scene['audio']['A3'].append({
|
||||
scene['audio-center']['A1'].append({
|
||||
'blank': True,
|
||||
'duration': offset
|
||||
})
|
||||
scene['audio-rear']['A1'].append({
|
||||
'blank': True,
|
||||
'duration': offset
|
||||
})
|
||||
vo_min += offset
|
||||
for vo in voice_overs:
|
||||
scene['audio']['A3'].append(vo)
|
||||
scene['audio-center']['A1'].append(vo)
|
||||
vo_low = vo.copy()
|
||||
vo_low['filter'] = {'volume': '-6'}
|
||||
scene['audio-rear']['A1'].append(vo_low)
|
||||
|
||||
clip = None
|
||||
while target - length > 0 and clips:
|
||||
|
@ -202,12 +219,16 @@ def compose(clips, target=150, base=1024, voice_over=None):
|
|||
blur = seq() * 3
|
||||
if blur:
|
||||
scene['back']['V1'][-1]['filter']['blur'] = blur
|
||||
scene['audio']['A1'].append({
|
||||
scene['back']['A1'].append({
|
||||
'duration': clip['duration'],
|
||||
'src': clip['original'],
|
||||
})
|
||||
# TBD: Foley
|
||||
scene['audio']['A2'].append({
|
||||
scene['audio-front']['A2'].append({
|
||||
'duration': clip['duration'],
|
||||
'src': foley,
|
||||
})
|
||||
scene['audio-rear']['A2'].append({
|
||||
'duration': clip['duration'],
|
||||
'src': foley,
|
||||
})
|
||||
|
@ -346,7 +367,9 @@ def render_all(options):
|
|||
if ext == '.wav':
|
||||
cmd += ['vn=1']
|
||||
else:
|
||||
cmd += ['an=1', 'vcodec=libx264', 'x264opts=keyint=1', 'crf=15']
|
||||
if not timeline.endswith("back.kdenlive"):
|
||||
cmd += ['an=1']
|
||||
cmd += ['vcodec=libx264', 'x264opts=keyint=1', 'crf=15']
|
||||
subprocess.call(cmd)
|
||||
if ext == '.wav' and timeline.endswith('audio.kdenlive'):
|
||||
cmd = [
|
||||
|
@ -362,9 +385,9 @@ 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-front.wav", "fl.wav", "fr.wav"),
|
||||
("audio-center.wav", "fc.wav", "lfe.wav"),
|
||||
("audio-rear.wav", "bl.wav", "br.wav"),
|
||||
):
|
||||
cmds.append([
|
||||
"ffmpeg", "-y",
|
||||
|
@ -390,15 +413,15 @@ def render_all(options):
|
|||
cmds.append([
|
||||
"ffmpeg", "-y",
|
||||
"-nostats", "-loglevel", "error",
|
||||
"-i", fragment_prefix / "back.mp4",
|
||||
"-i", fragment_prefix / "front.mp4",
|
||||
"-i", fragment_prefix / "audio-5.1.mp4",
|
||||
"-c", "copy",
|
||||
fragment_prefix / "back-5.1.mp4",
|
||||
fragment_prefix / "front-5.1.mp4",
|
||||
])
|
||||
for cmd in cmds:
|
||||
#print(" ".join([str(x) for x in cmd]))
|
||||
subprocess.call(cmd)
|
||||
shutil.move(fragment_prefix / "back-5.1.mp4", fragment_prefix / "back.mp4")
|
||||
shutil.move(fragment_prefix / "front-5.1.mp4", fragment_prefix / "front.mp4")
|
||||
for fn in (
|
||||
"audio-5.1.mp4", "fl.wav", "fr.wav", "fc.wav", "lfe.wav", "bl.wav", "br.wav",
|
||||
):
|
||||
|
|
|
@ -500,7 +500,7 @@ class KDEnliveProject:
|
|||
["0", "00:00:00.000=%s" % value],
|
||||
["kdenlive:collapsed", "0"],
|
||||
])]
|
||||
if name == "blur":
|
||||
elif name == "blur":
|
||||
return [self.get_element("filter", [
|
||||
["mlt_service", "avfilter.avgblur"],
|
||||
["kdenlive_id", "avfilter.avgblur"],
|
||||
|
@ -509,7 +509,7 @@ class KDEnliveProject:
|
|||
["planes", "7"],
|
||||
["kdenlive:collapsed", "0"],
|
||||
])]
|
||||
if name == "mask":
|
||||
elif name == "mask":
|
||||
mask = [
|
||||
self.get_element("filter", [
|
||||
["mlt_service", "frei0r.saturat0r"],
|
||||
|
@ -532,6 +532,15 @@ class KDEnliveProject:
|
|||
])
|
||||
]
|
||||
return mask
|
||||
elif name == "volume":
|
||||
return [self.get_element("filter", [
|
||||
["window", "75"],
|
||||
["max_gain", "20db"],
|
||||
["mlt_service", "volume"],
|
||||
["kdenlive_id", "volume"],
|
||||
["level", "00:00:00.000=%s" % value],
|
||||
["kdenlive:collapsed", "0"],
|
||||
])]
|
||||
else:
|
||||
return [
|
||||
self.get_element("filter", [
|
||||
|
|
Loading…
Reference in a new issue