0

I am trying to show an image while audio is playing, and when the audio is done playing the image disappears.

This is as far as I got:

image1 = mpy.ImageClip(image1_path).set_audio(mpy.AudioFileClip(audio1_path))

The problem with the above code is that the image will remain visible even after the audio is done.

mrr67man
  • 85
  • 2
  • 8

1 Answers1

1

Use .set_duration():

audio = mpy.AudioFileClip(audio1_path)
image1 = mpy.ImageClip(image1_path).set_audio(audio).set_duration(audio.duration)
Tom Burrows
  • 2,225
  • 2
  • 29
  • 46