code: def cut_video_stream(stream, start, end, fmt):
      
      with TemporaryDirectory() as tmp:
          in_file = Path(tmp) / f"in{fmt}"
          out_file = Path(tmp) / f"out{fmt}"
  
          in_file.write_bytes(stream)
  
          try:
              ret = subprocess.run(
                  [
                      "ffmpeg",
                      "-ss",
                      f"{start}",
                      "-i",
                      f"{in_file}",
                      "-to",
                      f"{end}",
                      "-c",
                      "copy",
                      f"{out_file}",
                  ],
                  capture_output=True,
              )
          except FileNotFoundError:
              result = stream
          else:
              if ret.returncode:
                  result = stream
              else:
                  result = out_file.read_bytes()
  
      return result
docs: cut video stream from `start` to `end` time
  
      Parameters
      ----------
      stream : bytes
          video file content
      start : float
          start time
      end : float
          end time
  
      Returns
      -------
      result : bytes
          content of cut video