react-native-compressor icon indicating copy to clipboard operation
react-native-compressor copied to clipboard

[Error] While compressing 4k video

Open rishabh-arch opened this issue 7 months ago • 8 comments

Current behavior

I am trying to compress this video with "auto" and "manual" both video link - https://signage-video-list-aws.s3.ap-south-1.amazonaws.com/video-1739112485062.mp4 video is 4k resolution.

metadata  - 
length : 20 sec
frame width : 3840
frame height : 2160
bitrate : 24551kbps

whenever i try to compress it throws an error

[java.lang.Throwable: java.lang.Throwable]

Expected behavior

I thought it will work on other device who have more memory. But still issue is same in all devices. but other videos under 1920 works fine.

Platform

  • [x] Android

React Native Version

0.77

React Native Compressor Version

"react-native-compressor": "^1.11.0",

Reproducible Steps And Demo

const compressionCallback = async (uri: string) => {
   const { compress } = compression;
   if (compress) {
     console.log("url123", url);
     const compressedUri = await Video.compress(uri, {
       compressionMethod: "manual",
       downloadProgress: (progress) => {
         // console.log("Compression progress:", progress);
         setProgress(progress);
       },
       progressDivider: 1,
       bitrate: 2_800_000,
       maxSize: 720,
     }).catch((err) => {
       console.log("Error in compression", err);
       return uri;
     });
     const newFilePath = `${downloadFolder}${fileName}`;
     console.log("Compressed file saved to:", newFilePath);
     const meta = await getVideoMetaData(compressedUri);
     console.log("MetaData", meta);
     await FileSystem.moveAsync({
       from: compressedUri,
       to: newFilePath,
     });
     return newFilePath;
   }
   return uri;
 };

rishabh-arch avatar Apr 05 '25 18:04 rishabh-arch