38 lines
1 KiB
Python
Executable file
38 lines
1 KiB
Python
Executable file
#!/usr/bin/python3
|
|
from glob import glob
|
|
import os
|
|
import shutil
|
|
import subprocess
|
|
|
|
for xml in sorted(glob('output/*/*.xml')):
|
|
if xml.endswith('.audio.xml'):
|
|
continue
|
|
audio_xml = xml.replace('.xml', '.audio.xml')
|
|
mp4 = xml.replace('.xml', '.mp4')
|
|
pre = mp4 + '.pre.mp4'
|
|
video = mp4 + '.v.mp4'
|
|
audio = mp4 + '.wav'
|
|
if not os.path.exists(mp4) or os.path.getmtime(xml) > os.path.getmtime(mp4):
|
|
subprocess.call([
|
|
'qmelt', xml, '-consumer', 'avformat:' + video, 'vcodec=libx264', 'strict=-2'
|
|
])
|
|
'''
|
|
subprocess.call([
|
|
'qmelt', audio_xml, '-consumer', 'avformat:' + audio,
|
|
])
|
|
cmd = [
|
|
'ffmpeg', '-y',
|
|
'-i', video,
|
|
'-i', audio,
|
|
'-map', '0:v',
|
|
'-map', '1:a',
|
|
'-c:v', 'copy',
|
|
'-strict', '-2',
|
|
pre
|
|
]
|
|
subprocess.call(cmd)
|
|
os.unlink(video)
|
|
os.unlink(audio)
|
|
shutil.move(pre, mp4)
|
|
'''
|
|
shutil.move(video, mp4)
|