Compare commits

...

3 commits

Author SHA1 Message Date
j
a5957fc3b2 50% chance of second foreground 2023-10-10 10:19:47 +01:00
j
d625ad8f4c render audio only 2023-10-10 10:19:36 +01:00
j
e10dfe039f fix sound 2023-10-10 10:19:24 +01:00
3 changed files with 31 additions and 6 deletions

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))

View file

@ -62,9 +62,14 @@ def compose(clips, target=150, base=1024):
break break
length += clip['duration'] length += clip['duration']
fg = clip['foreground']
if 'foreground2' in clip:
if chance(seq, 0.5):
fg = clip['foreground2']
scene['front']['V1'].append({ scene['front']['V1'].append({
'duration': clip['duration'], 'duration': clip['duration'],
'src': clip['foreground'], 'src': fg,
"filter": { "filter": {
'transparency': seq() / 10, 'transparency': seq() / 10,
} }
@ -110,7 +115,7 @@ def compose(clips, target=150, base=1024):
}) })
scene['audio']['A2'].append({ scene['audio']['A2'].append({
'duration': clip['duration'], 'duration': clip['duration'],
'src': clip['foreground'], 'src': fg,
}) })
return scene return scene

View file

@ -19,8 +19,16 @@ class KDEnliveProject:
def to_xml(self): def to_xml(self):
track = self._main_tractor.xpath(".//track")[0] track = self._main_tractor.xpath(".//track")[0]
duration = max(self._duration.values()) duration = max(self._duration.values())
track.attrib["in"] = self._sequence.attrib["in"] = self._main_tractor.attrib["in"] = "0" values = {
track.attrib["out"] = self._sequence.attrib["out"] = self._main_tractor.attrib["out"] = str(duration - 1) "in": "0",
"out": str(duration - 1)
}
for key, value in values.items():
track.attrib[key] = value
self._sequence.attrib[key] = value
self._main_tractor.attrib[key] = value
self._audio_tractor.attrib[key] = value
self._tree.remove(self._sequence) self._tree.remove(self._sequence)
self._tree.append(self._sequence) self._tree.append(self._sequence)
self._tree.remove(self._main_bin) self._tree.remove(self._main_bin)
@ -305,6 +313,7 @@ class KDEnliveProject:
self._sequence = sequence self._sequence = sequence
self._main_bin = main_bin self._main_bin = main_bin
self._main_tractor = t4 self._main_tractor = t4
self._audio_tractor = t1
self._v1 = v1 self._v1 = v1
self._v2 = v2 self._v2 = v2
self._a1 = a1 self._a1 = a1
@ -334,7 +343,7 @@ class KDEnliveProject:
("kdenlive:clip_type", "0"), ("kdenlive:clip_type", "0"),
("kdenlive:folderid", "-1"), ("kdenlive:folderid", "-1"),
("kdenlive:id", kdenlive_id), ("kdenlive:id", kdenlive_id),
("set.test_audio", "1"), ("set.test_audio", "0"),
("set.test_image", "0"), ("set.test_image", "0"),
("xml", "was here"), ("xml", "was here"),
]: ]: