Source code for terminhtml_recorder.video
from dataclasses import dataclass
from pathlib import Path
import moviepy.editor as mp
[docs]@dataclass
class Video:
path: Path
clip: mp.VideoFileClip
[docs] @classmethod
def from_path(cls, path: Path) -> "Video":
return cls(path=path, clip=mp.VideoFileClip(str(path.resolve())))
[docs] def transform_clip(self, begin_after: float, scale: float) -> mp.VideoFileClip:
return self.clip.subclip(begin_after, self.clip.duration).resize(scale)