I'm trying to add watermark on very short part of the mp4 video. It has to be very, very fast. Now I tried to do it with moviepy Here is my code:
import moviepy.editor as mp
video = mp.VideoFileClip("video.mp4")
part1 = video.subclip(0,10)
part2 = video.subclip(10,15)
part3 = video.subclip(15,152.56)
logo = (mp.ImageClip("logo.png")
.set_duration(part2.duration)
.resize(height=50) # if you need to resize...
.margin(right=8, top=8, opacity=0) # (optional) logo-border padding
.set_pos(("right","top")))
partSubtitles = mp.CompositeVideoClip([part2, logo])
final_clip = mp.concatenate_videoclips([part1, partSubtitles, part3])
final_clip.write_videofile("my_concatenation.mp4")
Adding a logo and merging videos works nearly instantly, but writing to disc takes 1 min for 2 min video what is significantly too long. Do you know a way of editing only a few frames and save that much faster?
Secondly, after conversion, the new file is approximately 40% larger. Why? How to fix that?