def get_command()

in augly/video/augmenters/ffmpeg/trim.py [0:0]


    def get_command(self, video_path: str, output_path: str) -> List[str]:
        """
        Trims the video

        @param video_path: the path to the video to be augmented

        @param output_path: the path in which the resulting video will be stored.

        @returns: a list of strings containing the CLI FFMPEG command for
            the augmentation
        """
        video_info = get_video_info(video_path)
        duration = float(video_info["duration"])

        if self.start is None and self.end is None:
            self.start = self.offset_factor * duration
            duration = min(self.duration_factor * duration, duration - self.start)
            self.end = self.start + duration
        elif self.start is None:
            self.start = 0
        elif self.end is None:
            self.end = duration

        return [
            *self.input_fmt(video_path),
            "-vf",
            f"trim={self.start}:{self.end}," + "setpts=PTS-STARTPTS",
            "-af",
            f"atrim={self.start}:{self.end}," + "asetpts=PTS-STARTPTS",
            *self.output_fmt(output_path),
        ]