Crossfading in MoviePy
Taking a cue from Simon Willison, a TIL (today I learned) about the moviepy library.
The library is very useful, but sometimes I have difficulty finding documentation on how to do specific things. For example, recently for NaMoGenMo I wanted to crossfade between 2 clips.
Suppose you have two 10-second video clips, and you want to cross-fade from clip A to clip B over 3 seconds. So clip A starts playing at 00:00, starts fading out at 00:07, and is completely faded out at 00:10. Clip B starts playing at 00:07, immediately starts fading in, and is finished fading in at 00:10. How you could accomplish that:
overlap = 3
final_clip = CompositeVideoClip([
clip_a.crossfadeout(overlap),
clip_b.set_start(clip_a.duration - overlap).crossfadein(overlap)
])