class_docstr: Creates a video component that can be used to upload/record videos (as an input) or display videos (as an output).
  For the video to be playable in the browser it must have a compatible container and codec combination. Allowed
  combinations are .mp4 with h264 codec, .ogg with theora codec, and .webm with vp9 codec. If the component detects
  that the output video would not be playable in the browser it will attempt to convert it to a playable mp4 video.
  If the conversion fails, the original video is returned.
  Preprocessing: passes the uploaded video as a {str} filepath or URL whose extension can be modified by `format`.
  Postprocessing: expects a {str} or {pathlib.Path} filepath to a video which is displayed, or a {Tuple[str | pathlib.Path, str | pathlib.Path | None]} where the first element is a filepath to a video and the second element is an optional filepath to a subtitle file.
  Examples-format: a {str} filepath to a local file that contains the video, or a {Tuple[str, str]} where the first element is a filepath to a video file and the second element is a filepath to a subtitle file.
  Demos: video_identity, video_subtitle
docstr: Convert subtitle format to VTT and process the video to ensure it meets the HTML5 requirements.
docstr_tok: ["Convert","subtitle","format","to","VTT","and","process","the","video","to","ensure","it","meets","the","HTML5","requirements","."]
code: def _format_subtitle(
      self, subtitle: str | Path | None
  ) -> FileData | None:
      """
      Convert subtitle format to VTT and process the video to ensure it meets the HTML5 requirements.
      """
  
      def srt_to_vtt(srt_file_path, vtt_file_path):
          """Convert an SRT subtitle file to a VTT subtitle file"""
          with open(srt_file_path, encoding="utf-8") as srt_file, open(
              vtt_file_path, "w", encoding="utf-8"
          ) as vtt_file:
              vtt_file.write("WEBVTT\n\n")
              for subtitle_block in (
                  srt_file.read().strip().split("\n\n")
              ):
                  subtitle_lines = subtitle_block.split("\n")
                  subtitle_timing = subtitle_lines[1].replace(",", ".")
                  subtitle_text = "\n".join(subtitle_lines[2:])
                  vtt_file.write(
                      f"{subtitle_timing} --> {subtitle_timing}\n"
                  )
                  vtt_file.write(f"{subtitle_text}\n\n")
  
      if subtitle is None:
          return None
  
      valid_extensions = (".srt", ".vtt")
  
      if Path(subtitle).suffix not in valid_extensions:
          raise ValueError(
              f"Invalid value for parameter `subtitle`: {subtitle}. Please choose a file with one of these extensions: {valid_extensions}"
          )
  
      # HTML5 only support vtt format
      if Path(subtitle).suffix == ".srt":
          temp_file = tempfile.NamedTemporaryFile(
              delete=False, suffix=".vtt", dir=self.GRADIO_CACHE
          )
  
          srt_to_vtt(subtitle, temp_file.name)
          subtitle = temp_file.name
  
      return FileData(path=str(subtitle))
  
imports: from __future__ import annotations
  import tempfile
  import warnings
  from pathlib import Path
  from typing import Any, Callable, Literal, Optional
  from gradio_client import utils
  from gradio_client.documentation import document, set_documentation_group
  import gradio
  from gradio import processing_utils, utils, wasm_utils
  from gradio.components.base import Component
  from gradio.data_classes import FileData, GradioModel
  from gradio.events import Events
label_desc: Use image node_id 5 for calling the Video obj's underlying member method code with example usage: obj._format_subtitle(subtitle) and returns: FileData, None