def get_frame_count(self) -> int:
        """
        Returns total frame count in the video

        Note that not all videos provide length / duration metainfo, so the
        result may require full video decoding.

        The total count is NOT affected by the frame filtering options of the object,
        i.e. start frame, end frame and frame step.
        """
        # It's possible to retrieve frame count from the stream.frames,
        # but the number may be incorrect.
        # https://superuser.com/questions/1512575/why-total-frame-count-is-different-in-ffmpeg-than-ffprobe
        if self._frame_count is not None:
            return self._frame_count

        frame_count = 0
        for _ in self.iterate_frames(frame_filter=False):
            frame_count += 1

        self._frame_count = frame_count

        return frame_count

        Returns total frame count in the video

        Note that not all videos provide length / duration metainfo, so the
        result may require full video decoding.

        The total count is NOT affected by the frame filtering options of the object,
        i.e. start frame, end frame and frame step.
        
cvat/apps/engine/media_extractors.py