Moviepy: MoviePy insert multiple images in a video

Created on 12 Aug 2018  路  4Comments  路  Source: Zulko/moviepy

Hi there,

I am using your example to insert an image into a video file:

import moviepy.editor as mp

video = mp.VideoFileClip("video.mp4")

logo = (mp.ImageClip("logo.png")
          .set_duration(video.duration)
          .resize(height=50) # if you need to resize...
          .margin(right=8, top=8, opacity=0) # (optional) logo-border padding
          .set_pos(("right","top")))

final = mp.CompositeVideoClip([video, logo])
final.subclip(1000,1010).write_videofile("test.mp4")

This actually pastes the image on top of all the frame in the video, how can I add the image in the video file at specific time. For example, I would like the Logo image to appear on its own at 5 sec, 15 sec & Logo2 (different logo) at 30 sec.

Is it possible with MoviePy?

Kind Regards

images

Most helpful comment

@1605200517 yes, thanks

All 4 comments

Just found this now, but in case it is useful:

# logo appears at t=5s for a duration of 3s
final = mp.CompositeVideoClip([video, logo.set_start(5).set_duration(3)])

Github is not the best place to ask for support, StackOverflow may work better.

@Zulko is this also the way to create a slide show from a sequence of images?
Stack question: https://softwarerecs.stackexchange.com/questions/52243/video-tutorials-as-code/52248#52248

side note: thank you and your contributors for delivering this awesome OSS product!

@1605200517 Did you manage to solve the problem with the answers provided on SE?

@1605200517 yes, thanks

Was this page helpful?
0 / 5 - 0 ratings

Related issues

buddhashrestha picture buddhashrestha  路  3Comments

xjcl picture xjcl  路  3Comments

arianaa30 picture arianaa30  路  4Comments

LaoYuanPython picture LaoYuanPython  路  3Comments

bilel picture bilel  路  4Comments