def _fetch_file_metadata(self) -> Tuple[float, float, Optional[Modality]]:
        """
        Fetch the metadata of the media file using ffmpeg. This includes the size, duration, and modality of the
        media file.

        Returns:
            Tuple[float, float, str]: A tuple containing the size (in bytes), duration (in seconds), and modality of the
            media file.

        """
        try:
            probe_options = {
                'v': 'error',
                'show_entries': 'stream=codec_type,format=size,duration,format_name',
                'of': 'json',
                'probesize': '256K',  # Probe only the first 256KB
            }

            if self.media_download_header:
                probe_options['headers'] = self.media_download_header

            probe = ffmpeg.probe(self.url, **probe_options)

            size = int(probe['format'].get('size', 0))
            duration = float(probe['format'].get('duration', 0))
            format_name = probe['format'].get('format_name', "")
            modality_list = [codec_type.get('codec_type', "") for codec_type in probe['streams']]
            modality = self._infer_modality_from_probe(modality_list, format_name)

            return size, duration, modality

        except ffmpeg.Error as e:
            raise MediaDownloadError(f"Error fetching metadata: {e.stderr.decode()}") from e

        Fetch the metadata of the media file using ffmpeg. This includes the size, duration, and modality of the
        media file.

        Returns:
            Tuple[float, float, str]: A tuple containing the size (in bytes), duration (in seconds), and modality of the
            media file.

        
src/marqo/inference/media_download_and_preprocess/streaming_media_processor.py