How to compress video React

My app hangs because i save my high-quality video to redux. How to compress it. Now my code works properly with no errors, but video size is too big.

function AddVideo() {
  const addingUploadedVideo = (e) => {
    e.preventDefault();
    if (uploadedVideo.length < 2) {
      const input = document.createElement("input");
      input.type = "file";
      input.accept = "video/*";
      input.onchange = handleFileInputChange;
      input.click();
    } else {
      alert("Maximum 2 videos can be uploaded.");
    }
  };

  const handleFileInputChange = (e) => {
    const file = e.target.files[0];
    if (file) {
      const reader = new FileReader();
      reader.onloadend = () => {
        dispatch(addUploadedVideo(reader.result));
      };
      reader.readAsDataURL(file);
    }
  };

  return (
    jsx
  );
}

asked chatgpt but it uses ffmpeg with 3-10 errors