chaowenguoback commited on
Commit
bccbb42
·
verified ·
1 Parent(s): c3c1aa6

Update yue.py

Browse files
Files changed (1) hide show
  1. yue.py +1 -0
yue.py CHANGED
@@ -272,6 +272,7 @@ async def main():
272
  buffer.truncate(0)
273
  PIL.Image.fromarray(reader[-1]).save(buffer, format='png')
274
  with av.open(io.BytesIO(await sys.modules.get(__name__).google(script.get('narration'))), format='mp3') as container:
 
275
  speed = builtins.float(container.streams.audio[0].duration * container.streams.audio[0].time_base) / 10
276
  graph = av.filter.Graph()
277
  graph.link_nodes(graph.add_abuffer(template=container.streams.audio[0]), graph.add('atempo', builtins.str(speed)), graph.add('apad', 'whole_dur=10'), graph.add('atrim', '0:10'), graph.add('abuffersink')).configure()
 
272
  buffer.truncate(0)
273
  PIL.Image.fromarray(reader[-1]).save(buffer, format='png')
274
  with av.open(io.BytesIO(await sys.modules.get(__name__).google(script.get('narration'))), format='mp3') as container:
275
+ if not audio: audio = writer.add_stream('aac', rate=container.streams.audio[0].rate)
276
  speed = builtins.float(container.streams.audio[0].duration * container.streams.audio[0].time_base) / 10
277
  graph = av.filter.Graph()
278
  graph.link_nodes(graph.add_abuffer(template=container.streams.audio[0]), graph.add('atempo', builtins.str(speed)), graph.add('apad', 'whole_dur=10'), graph.add('atrim', '0:10'), graph.add('abuffersink')).configure()