pandora_cdosea/encode.py
2017-02-17 22:42:57 +01:00

24 lines
703 B
Python
Executable file

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