more sound
This commit is contained in:
parent
21b6ef9cef
commit
ade3f53db2
2 changed files with 42 additions and 22 deletions
55
render.py
55
render.py
|
|
@ -14,7 +14,7 @@ import ox
|
|||
|
||||
from .pi import random
|
||||
from .render_kdenlive import KDEnliveProject, _CACHE, get_melt
|
||||
from .utils import resolve_roman, write_if_new, format_duration
|
||||
from .utils import resolve_roman, write_if_new, format_duration, needs_update
|
||||
from .render_utils import *
|
||||
|
||||
default_prefix = "/srv/p_for_power"
|
||||
|
|
@ -153,7 +153,7 @@ def compose(clips, fragment, target=150, base=1024, voice_over=None, options=Non
|
|||
}
|
||||
})
|
||||
|
||||
volume_front = '-14'
|
||||
volume_front = '-15'
|
||||
if clip.get('volume') is not None:
|
||||
volume_front = '%0.2f' % (float(volume_front) + clip['volume'])
|
||||
|
||||
|
|
@ -263,11 +263,11 @@ def compose(clips, fragment, target=150, base=1024, voice_over=None, options=Non
|
|||
print('%07.3f-%07.3f %07.3f' % (sub_offset, sub_offset+vo["duration"], vo["duration"]), vo["src"].split('/')[-1])
|
||||
voice_overs.append(vo)
|
||||
voc = vo.copy()
|
||||
a, b = '5', '-1'
|
||||
a, b = '4', '-2'
|
||||
#if options.get('stereo_downmix'):
|
||||
# a, b = '5', '-1'
|
||||
if vo_b:
|
||||
a, b = '3', '-3'
|
||||
a, b = '2', '-4'
|
||||
voc['filter'] = {'volume': a}
|
||||
scene['audio-center']['A1'].append(voc)
|
||||
vo_low = vo.copy()
|
||||
|
|
@ -553,10 +553,11 @@ def render_all(options):
|
|||
ext = '.mp4'
|
||||
if '/audio' in timeline:
|
||||
ext = '.wav'
|
||||
out = '%s' % timeline.replace('.kdenlive', ext)
|
||||
cmd = get_melt() + [
|
||||
timeline,
|
||||
'-quiet',
|
||||
'-consumer', 'avformat:%s' % timeline.replace('.kdenlive', ext),
|
||||
'-consumer', 'avformat:%s' % out,
|
||||
]
|
||||
if ext == '.wav':
|
||||
cmd += ['vn=1']
|
||||
|
|
@ -566,7 +567,8 @@ def render_all(options):
|
|||
cmd += ['vcodec=h264_qsv', 'pix_fmt=nv12', 'rc=icq', 'global_quality=17']
|
||||
elif options.get("only_keyframes"):
|
||||
cmd += ['vcodec=libx264', 'x264opts=keyint=1', 'crf=15']
|
||||
subprocess.call(cmd)
|
||||
if needs_update(timeline, out):
|
||||
subprocess.call(cmd)
|
||||
if ext == '.wav' and timeline.endswith('audio.kdenlive'):
|
||||
cmd = [
|
||||
'ffmpeg', '-y',
|
||||
|
|
@ -575,8 +577,12 @@ def render_all(options):
|
|||
timeline.replace('.kdenlive', ext),
|
||||
timeline.replace('.kdenlive', '.mp4')
|
||||
]
|
||||
subprocess.call(cmd)
|
||||
os.unlink(timeline.replace('.kdenlive', ext))
|
||||
wav = timeline.replace('.kdenlive', ext)
|
||||
mp4 = timeline.replace('.kdenlive', '.mp4')
|
||||
if needs_update(wav, mp4):
|
||||
subprocess.call(cmd)
|
||||
if not options.get("keep_parts"):
|
||||
os.unlink(wav)
|
||||
|
||||
cmds = []
|
||||
fragment_prefix = Path(fragment_prefix)
|
||||
|
|
@ -667,10 +673,11 @@ def render_all(options):
|
|||
"vocals.wav",
|
||||
"foley.wav"
|
||||
]
|
||||
for fn in cleanup:
|
||||
fn = fragment_prefix / fn
|
||||
if os.path.exists(fn):
|
||||
os.unlink(fn)
|
||||
if not options.get("keep_parts"):
|
||||
for fn in cleanup:
|
||||
fn = fragment_prefix / fn
|
||||
if os.path.exists(fn):
|
||||
os.unlink(fn)
|
||||
|
||||
if is_new and options["single_file"]:
|
||||
cmds = []
|
||||
|
|
@ -698,21 +705,25 @@ def render_all(options):
|
|||
cmd += ['vcodec=h264_qsv', 'pix_fmt=nv12', 'rc=icq', 'global_quality=17']
|
||||
elif options.get("only_keyframes"):
|
||||
cmd += ['vcodec=libx264', 'x264opts=keyint=1', 'crf=15']
|
||||
cmds.append(cmd)
|
||||
if needs_update(timelines[0], out):
|
||||
cmds.append(cmd)
|
||||
|
||||
for src, out1, out2 in (
|
||||
("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",
|
||||
"-nostats", "-loglevel", "error",
|
||||
"-i", base_prefix / src,
|
||||
"-filter_complex",
|
||||
"[0:0]pan=1|c0=c0[left]; [0:0]pan=1|c0=c1[right]",
|
||||
"-map", "[left]", base_prefix / out1,
|
||||
"-map", "[right]", base_prefix / out2,
|
||||
])
|
||||
if needs_update(src, out1):
|
||||
cmds.append([
|
||||
"ffmpeg", "-y",
|
||||
"-nostats", "-loglevel", "error",
|
||||
"-i", base_prefix / src,
|
||||
"-filter_complex",
|
||||
"[0:0]pan=1|c0=c0[left]; [0:0]pan=1|c0=c1[right]",
|
||||
"-map", "[left]", base_prefix / out1,
|
||||
"-map", "[right]", base_prefix / out2,
|
||||
])
|
||||
|
||||
cmds.append([
|
||||
"ffmpeg", "-y",
|
||||
"-nostats", "-loglevel", "error",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue