def apply(self, clip: Clip) -> Clip:
        """Apply the effect to the clip."""
        if self.region is not None:
            x1, y1, _x2, _y2 = self.region
            freeze = (
                clip.with_effects([Crop(*self.region)])
                .to_ImageClip(t=self.t)
                .with_duration(clip.duration)
                .with_position((x1, y1))
            )
            return CompositeVideoClip([clip, freeze])

        elif self.outside_region is not None:
            x1, y1, x2, y2 = self.outside_region
            animated_region = clip.with_effects(
                [Crop(*self.outside_region)]
            ).with_position((x1, y1))
            freeze = clip.to_ImageClip(t=self.t).with_duration(clip.duration)
            return CompositeVideoClip([freeze, animated_region])

        elif self.mask is not None:
            freeze = (
                clip.to_ImageClip(t=self.t)
                .with_duration(clip.duration)
                .with_mask(self.mask)
            )
            return CompositeVideoClip([clip, freeze])
Apply the effect to the clip.
moviepy/video/fx/FreezeRegion.py