numandev1/react-native-compressor

Video Quality lost

Opened this issue · 6 comments

when I am uploading video from my react native app then it was going to reduce the quality of the video.

👋 @alihussainkabri
Thanks for opening your issue here! If you find this package useful hit the star🌟!

That's the goal of the package... If you reduce the size of your video/image a bit of the quality will be lost.
if you think your video quality is too low, simply reduce the compression level
It's not an issue, you can close it

This is a code I made to use compression in percent :

const videoCompressionLevel = 40;
                const originalVideoMetada : VideoMetada = await getVideoMetaData(result.assets[0].uri) as VideoMetada;
                const targetBitrate : number = Math.round((originalVideoMetada.size) / ((originalVideoMetada.duration / 60) * 0.0075) * (1 - (videoCompressionLevel / 100)))

                const compressedVideo = await VideoCompressor.compress(
                    result.assets[0].uri,
                    {
                    
                        progressDivider: 20,
                        maxSize: 1920,
                        bitrate: targetBitrate,
                        compressionMethod: "manual",
                        downloadProgress: (progress) => {
                            console.log('downloadProgress: ', progress);
                        },
                    },
                    (progress) => {
                        console.log('Compression Progress: ', progress);
                    }
                ); 
```  if this fits your needs, don't forget to close the issue 

I have tried putting different values of Bitrate but I am getting the same Output every time

you need to put compressionMethod: "manual". I tried the way, I got different outputs but the quality is not good any any output.