render audio only

This commit is contained in:
j 2023-10-10 10:19:36 +01:00
parent e10dfe039f
commit d625ad8f4c

View file

@ -30,10 +30,21 @@ class Command(BaseCommand):
json.dump(scene, fd, indent=2, ensure_ascii=False) json.dump(scene, fd, indent=2, ensure_ascii=False)
if not options['no_video']: if not options['no_video']:
for timeline in timelines: for timeline in timelines:
ext = '.mp4'
if '-audio.kdenlive' in timeline:
ext = '.wav'
cmd = [ cmd = [
'xvfb-run', '-a', 'xvfb-run', '-a',
'melt', timeline, 'melt', timeline,
'-consumer', 'avformat:%s' % timeline.replace('.kdenlive', '.mp4') '-consumer', 'avformat:%s' % timeline.replace('.kdenlive', ext)
] ]
subprocess.call(cmd) subprocess.call(cmd)
if ext == '.wav':
cmd = [
'ffmpeg', '-i',
timeline.replace('.kdenlive', ext),
timeline.replace('.kdenlive', '.mp4')
]
subprocess.call(cmd)
os.unlink(timeline.replace('.kdenlive', ext))