is new rendering
This commit is contained in:
parent
1c235dfd2a
commit
4bb1c6c835
2 changed files with 61 additions and 27 deletions
47
encode.py
47
encode.py
|
@ -7,6 +7,8 @@ import shutil
|
||||||
import subprocess
|
import subprocess
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
|
cleanup = True
|
||||||
|
|
||||||
def get_videoduration(video):
|
def get_videoduration(video):
|
||||||
cmd = [
|
cmd = [
|
||||||
'ffprobe',
|
'ffprobe',
|
||||||
|
@ -52,6 +54,12 @@ def encode(xml, force=False, prefix='.'):
|
||||||
public_mp4 = os.path.join(prefix, 'public', mp4.split('/')[-1][0].lower() + mp4.split('/')[-2] + '.1080p.mp4')
|
public_mp4 = os.path.join(prefix, 'public', mp4.split('/')[-1][0].lower() + mp4.split('/')[-2] + '.1080p.mp4')
|
||||||
public_mp4_480p = public_mp4.replace('.1080p.mp4', '.480p.mp4')
|
public_mp4_480p = public_mp4.replace('.1080p.mp4', '.480p.mp4')
|
||||||
|
|
||||||
|
gongs = 'performance' in prefix
|
||||||
|
gongs_wav = mp4.replace('.mp4', '.gongs.wav')
|
||||||
|
gongs_left = mp4.replace('.mp4', '.gongs.right.wav')
|
||||||
|
gongs_right = mp4.replace('.mp4', '.gongs.left.wav')
|
||||||
|
|
||||||
|
force = True
|
||||||
|
|
||||||
if force or is_new(xml, public_mp4):
|
if force or is_new(xml, public_mp4):
|
||||||
print(public_mp4)
|
print(public_mp4)
|
||||||
|
@ -61,7 +69,9 @@ def encode(xml, force=False, prefix='.'):
|
||||||
'vcodec=libx264',
|
'vcodec=libx264',
|
||||||
'acodec=pcm_s16le'
|
'acodec=pcm_s16le'
|
||||||
]
|
]
|
||||||
|
if is_new(xml, video):
|
||||||
subprocess.call(cmd)
|
subprocess.call(cmd)
|
||||||
|
|
||||||
duration = get_videoduration(video)
|
duration = get_videoduration(video)
|
||||||
cmd = [
|
cmd = [
|
||||||
'ffmpeg', '-y', '-i', video,
|
'ffmpeg', '-y', '-i', video,
|
||||||
|
@ -69,24 +79,41 @@ def encode(xml, force=False, prefix='.'):
|
||||||
'-map_channel', '0.1.1', right,
|
'-map_channel', '0.1.1', right,
|
||||||
]
|
]
|
||||||
subprocess.call(cmd)
|
subprocess.call(cmd)
|
||||||
|
if gongs:
|
||||||
|
cmd = [
|
||||||
|
'ffmpeg', '-y', '-i', gongs_wav,
|
||||||
|
'-map_channel', '0.0.0', gongs_left,
|
||||||
|
'-map_channel', '0.0.1', gongs_right,
|
||||||
|
]
|
||||||
|
subprocess.call(cmd)
|
||||||
cmd = [
|
cmd = [
|
||||||
'qmelt', vocals_xml, '-consumer',
|
'qmelt', vocals_xml, '-consumer',
|
||||||
'avformat:' + vocals,
|
'avformat:' + vocals,
|
||||||
'acodec=pcm_s16le',
|
'acodec=pcm_s16le',
|
||||||
'ac=1'
|
'ac=1'
|
||||||
]
|
]
|
||||||
|
if is_new(xml, vocals):
|
||||||
subprocess.call(cmd)
|
subprocess.call(cmd)
|
||||||
#for wav in (left, right, vocals):
|
#for wav in (left, right, vocals):
|
||||||
# cmd = ['normalize-audio', wav]
|
# cmd = ['normalize-audio', wav]
|
||||||
# subprocess.call(cmd)
|
# subprocess.call(cmd)
|
||||||
|
front_left = left
|
||||||
|
front_right = left
|
||||||
|
front_center = vocals
|
||||||
|
lfe = silence
|
||||||
|
back_left = vocals
|
||||||
|
back_right = vocals
|
||||||
|
if gongs:
|
||||||
|
back_left = gongs_left
|
||||||
|
back_right = gongs_right
|
||||||
cmd = [
|
cmd = [
|
||||||
'ffmpeg', '-y',
|
'ffmpeg', '-y',
|
||||||
'-i', left, # FL
|
'-i', front_left, # FL
|
||||||
'-i', right, # FR
|
'-i', front_right, # FR
|
||||||
'-i', vocals, # FC
|
'-i', front_center, # FC
|
||||||
'-i', silence, # LFE
|
'-i', lfe, # LFE
|
||||||
'-i', vocals, # BL
|
'-i', back_left, # BL
|
||||||
'-i', vocals, # BR
|
'-i', back_right, # BR
|
||||||
'-filter_complex',
|
'-filter_complex',
|
||||||
'[0:0][1:0][2:0][3:0][4:0][5:0] amerge=inputs=6[aout]',
|
'[0:0][1:0][2:0][3:0][4:0][5:0] amerge=inputs=6[aout]',
|
||||||
'-map', "[aout]",
|
'-map', "[aout]",
|
||||||
|
@ -95,9 +122,13 @@ def encode(xml, force=False, prefix='.'):
|
||||||
amix
|
amix
|
||||||
]
|
]
|
||||||
subprocess.call(cmd)
|
subprocess.call(cmd)
|
||||||
|
if cleanup:
|
||||||
os.unlink(left)
|
os.unlink(left)
|
||||||
os.unlink(right)
|
os.unlink(right)
|
||||||
os.unlink(vocals)
|
os.unlink(vocals)
|
||||||
|
if gongs:
|
||||||
|
os.unlink(gongs_left)
|
||||||
|
os.unlink(gongs_right)
|
||||||
|
|
||||||
cmd = [
|
cmd = [
|
||||||
'ffmpeg', '-y',
|
'ffmpeg', '-y',
|
||||||
|
@ -111,8 +142,10 @@ def encode(xml, force=False, prefix='.'):
|
||||||
mp4
|
mp4
|
||||||
]
|
]
|
||||||
subprocess.call(cmd)
|
subprocess.call(cmd)
|
||||||
|
if cleanup:
|
||||||
os.unlink(video)
|
os.unlink(video)
|
||||||
os.unlink(amix)
|
os.unlink(amix)
|
||||||
|
if is_new(mp4, public_mp4_480p):
|
||||||
cmd = [
|
cmd = [
|
||||||
'ffmpeg', '-y',
|
'ffmpeg', '-y',
|
||||||
'-i', mp4,
|
'-i', mp4,
|
||||||
|
@ -126,8 +159,8 @@ def encode(xml, force=False, prefix='.'):
|
||||||
mp4_480p
|
mp4_480p
|
||||||
]
|
]
|
||||||
subprocess.call(cmd)
|
subprocess.call(cmd)
|
||||||
shutil.move(mp4, public_mp4)
|
|
||||||
shutil.move(mp4_480p, public_mp4_480p)
|
shutil.move(mp4_480p, public_mp4_480p)
|
||||||
|
shutil.move(mp4, public_mp4)
|
||||||
cmd = [
|
cmd = [
|
||||||
'./subtitles.py',
|
'./subtitles.py',
|
||||||
'--prefix', prefix,
|
'--prefix', prefix,
|
||||||
|
|
|
@ -230,6 +230,7 @@ if version == 'performance':
|
||||||
|
|
||||||
# mix gongs + music
|
# mix gongs + music
|
||||||
mtractor = mix_audio_tracks(gongs, music, 0.15)
|
mtractor = mix_audio_tracks(gongs, music, 0.15)
|
||||||
|
|
||||||
else:
|
else:
|
||||||
# mix drones + music
|
# mix drones + music
|
||||||
mtractor = mix_audio_tracks(drones, music, 0.3)
|
mtractor = mix_audio_tracks(drones, music, 0.3)
|
||||||
|
|
Loading…
Reference in a new issue