def _convert_training_videos(video_folder: Path, target_folder: Path) -> None:
        """Re-code training videos for correct frame reading by torchvision.

        The encoding of the raw video files in the ShanghaiTech dataset causes
        issues when reading frames using pyav. To prevent this, frames are read
        using opencv and written to new video files that can be parsed correctly
        with pyav.

        Args:
            video_folder (Path): Path to the folder containing training videos.
            target_folder (Path): Path where converted videos will be stored.
        """
        training_videos = sorted(video_folder.glob("*"))
        for video_idx, video_path in enumerate(training_videos):
            logger.info(
                "Converting training video %s (%i/%i)...",
                video_path.name,
                video_idx + 1,
                len(training_videos),
            )
            file_name = video_path.name
            target_path = target_folder / file_name
            convert_video(video_path, target_path, codec="XVID")
Re-code training videos for correct frame reading by torchvision.

        The encoding of the raw video files in the ShanghaiTech dataset causes
        issues when reading frames using pyav. To prevent this, frames are read
        using opencv and written to new video files that can be parsed correctly
        with pyav.

        Args:
            video_folder (Path): Path to the folder containing training videos.
            target_folder (Path): Path where converted videos will be stored.
        
src/anomalib/data/datamodules/video/shanghaitech.py