tmp files
This commit is contained in:
parent
9dda2f1c34
commit
593fba2b11
1 changed files with 14 additions and 7 deletions
21
encode.py
21
encode.py
|
@ -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)
|
||||
|
|
Loading…
Reference in a new issue