Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Video is not resizing #65

Closed
unoegohh opened this issue Dec 20, 2021 · 6 comments
Closed

Video is not resizing #65

unoegohh opened this issue Dec 20, 2021 · 6 comments

Comments

@unoegohh
Copy link

unoegohh commented Dec 20, 2021

Hi! I am having troubles with video compression

"react-native-compressor": "1.2.0"
"react-native": "0.66.1"

Video.compress(file.path, {
        // compressionMethod: 'manual',
        //minimumFileSizeForCompress: 10,
        maxSize: 100,
      })
        .then(res => {...})
        .catch(console.log);

original file
original file is 42mb 1080 × 1920 30 sec
compressed always 3.2 mb 360 × 568

i need to do something to make video 600x1000
i have tried all params from doc but nothing changes( mb i am doing something wrong
and i tried different video

@numandev1
Copy link
Owner

@unoegohh let me see it

@numandev1
Copy link
Owner

@unoegohh are you want manual compression or auto compression-like WhatsApp?

@numandev1
Copy link
Owner

@unoegohh if I use maxSize: 1000 then I am getting 562x1000 resolution of the video which you have attached

const dstUrl = await Video.compress(
      sourceVideo,
      {
        compressionMethod: 'auto',
        minimumFileSizeForCompress: 5,
        maxSize: 1000,
      },
      (progress) => {
        if (backgroundMode) {
          console.log('Compression Progress: ', progress);
        } else {
          setCompressingProgress(progress);
        }
      }
    );

@unoegohh
Copy link
Author

unoegohh commented Dec 21, 2021

Hmm it is strange cause if i use

import {Video as VideoCompressor} from 'react-native-compressor';

VideoCompressor.compress(file.path, {
        compressionMethod: 'auto',
        minimumFileSizeForCompress: 5,
        maxSize: 1000,
      })
        .then(res => {
          console.log('video', res);
        })
        .catch(console.log);

and then i get

video1 file:///Users/unoegohh/Library/Developer/CoreSimulator/Devices/C856B11B-463E-48F6-9396-5F4E0838CDC2/data/Containers/Data/Application/60489947-00AB-49D1-A5F0-E72164EDD6D5/tmp/react-native-image-crop-picker/F6B9FBB8-4C2A-4882-ABBC-A3E9BFE8A0C7.mp4

and it is still get 320x564 video

file

UPD - i got my error) i was using ImagePicker.openPicker before compression and it returned already compressed video
)) ty! as always i need to find error on my side first then write an issue)

@numandev1
Copy link
Owner

numandev1 commented Dec 21, 2021

@unoegohh yes react-native-image-crop-picker =>. openPicker is compressing video by reducing video height and width. can you put your video file into tmp directory and add a path directly to test VideoCompressor.compress("file:///...../tmp/filename.mp4"

@numandev1
Copy link
Owner

I think it is already fixed. feel free to reopen if you see this problem again. thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants