tmp files

This commit is contained in:
j 2017-02-17 22:49:32 +01:00
parent 9dda2f1c34
commit 593fba2b11

View file

@ -1,24 +1,31 @@
#!/usr/bin/python3
import subprocess
import os
from glob import glob
import os
import shutil
import subprocess
for xml in glob('output/*.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:' + mp4 + '.mp4', 'vcodec=libx264'
'qmelt', xml, '-consumer', 'avformat:' + video, 'vcodec=libx264'
])
subprocess.call([
'qmelt', xml, '-consumer', 'avformat:' + mp4 + '.wav',
'qmelt', xml, '-consumer', 'avformat:' + audio,
])
subprocess.call([
'ffmpeg', '-y',
'-i', mp4 + '.mp4',
'-i', mp4 + '.wav',
'-i', video,
'-i', audio,
'-c:v', 'copy',
'-map', '0:v',
'-map', '1:a',
'-strict', '-2',
mp4
pre
])
os.unlink(video)
os.unlink(audio)
shutil.move(pre, mp4)