Moviepy: How to concatenate videos with crossfadein / crossfadeout ?

Created on 15 Mar 2018  路  3Comments  路  Source: Zulko/moviepy

Pure concatenate_videos, even if you apply fadein fadeout effects does not acctually overlaps videos.
Can i achive the same result with CompositeVideoClip?

examples question video

Most helpful comment

It seems it's not that trivial for a new user, i ended up doing something like this:

`

padding = 1.5 # padding option

video_clips = [VideoFileClip(video) for video in clip_list]  #  clips to concatenate

video_fx_list = [video_clips[0]]
# set padding to initial video

idx = video_clips[0].duration - padding
for video in video_clips[1:]:
    video_fx_list.append(video.set_start(idx).crossfadein(padding))
    idx += video.duration - padding

final_video = CompositeVideoClip(video_fx_list)
final_video.write_videofile('my-outfile', fps=24)`

Nevertheless I think it should be as explicit example in documentation

All 3 comments

@PyB1l please, check this answer https://www.reddit.com/r/moviepy/comments/2f43e3/crossfades/ck7dzby

@Zulko @tburrows13 do you agree this should be explicited at least as an example in the docs?

and what about to add an extra (optional) argument to concatenate_videoclips named transition_effect as a string or function, to simplify these typical minimal usage? For instance, this case would be something like

concatenate_videoclips([v1, v2, v3], effect='crossfadein', padding=-2)

Any update on this?

It seems it's not that trivial for a new user, i ended up doing something like this:

`

padding = 1.5 # padding option

video_clips = [VideoFileClip(video) for video in clip_list]  #  clips to concatenate

video_fx_list = [video_clips[0]]
# set padding to initial video

idx = video_clips[0].duration - padding
for video in video_clips[1:]:
    video_fx_list.append(video.set_start(idx).crossfadein(padding))
    idx += video.duration - padding

final_video = CompositeVideoClip(video_fx_list)
final_video.write_videofile('my-outfile', fps=24)`

Nevertheless I think it should be as explicit example in documentation

Was this page helpful?
0 / 5 - 0 ratings

Related issues

xjcl picture xjcl  路  3Comments

djevo1 picture djevo1  路  3Comments

TowelDude picture TowelDude  路  3Comments

arianaa30 picture arianaa30  路  4Comments

tburrows13 picture tburrows13  路  3Comments