简体   繁体   中英

Set Audio for ImageClip using MoviePy

I'm trying to turn a static png + audio into a video clip which I can then concatenate along with other video clips.

intro = ImageClip(r'D:\skrooby\Vanity\timestamp.png', duration=3)
intro.set_audio(r'D:\skrooby\introsong.mp3')
outro = ImageClip(r'D:\skrooby\Vanity\continue.png', duration=20)
outro.set_audio(r'D:\skrooby\outrosong.mp3')

While this did not raise any errors, the produced clip does not have any sound over the intro and outro sections. How can I play the audio (audio files have 3 and 20s durations correspondingly) over my images?

set_audio returns a copy of the clip. Do intro = intro.set_audio(...) instead.

The name is definitely confusing so in v2.0 it is being changed to with_audio : github.com/Zulko/moviepy/pull/1170

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM