shahen94 / react-native-video-processing

Native Video editing/trimming/compressing :movie_camera: library for React-Native
https://shahen94.github.io/react-native-video-processing/
MIT License
1.25k stars 325 forks source link

Problem with android compression #89

Open mannol opened 6 years ago

mannol commented 6 years ago

When width and height props are used as compress options in ProcessingManager.compress(), they are parsed with decimal points to scale parameter which causes compression to fail.

The following code in Trimmer.java produces: Copmress resolution: -> 405.0:720.0 when it should be Copmress resolution: -> 405:720.

if (width != null && height != null) {
  Log.w(LOG_TAG, "Copmress resolution: -> " + Double.toString(width) + ":" + Double.toString(height));
  cmd.add("-vf");
  cmd.add("scale=" + Double.toString(width) + ":" + Double.toString(height));
}

Double.toString() simply won't cut it.

kesha-antonov commented 6 years ago

Nice catch! Meanwhile I didn't have any problems with crop

kesha-antonov commented 6 years ago

Hey @mannol Did you encountered issue when video wasn't trimmed? I mean you try to trim video but it remains the same. In what situations that could be?

mannol commented 6 years ago

@kesha-antonov no. Didn't have any issues with trimming other than it too was a blocking operation.

kesha-antonov commented 6 years ago

Ok. try this https://github.com/shahen94/react-native-video-processing/pull/91

kesha-antonov commented 6 years ago

Sorry for spamming this thread.

@mannol What do you think - maybe we should do "copy" and "chmod" async task too? https://github.com/shahen94/react-native-video-processing/blob/master/android/src/main/java/com/shahenlibrary/Trimmer/Trimmer.java#L540

I'm worried that when user opens app first he'll wait until ffmpeg will be copied and chmod'ed

mannol commented 6 years ago

Yeah. Also, that should be done once only if the file doesn't exist already.

kesha-antonov commented 6 years ago

There is check already

kesha-antonov commented 6 years ago

Ok. I'll add async task for that later

mannol commented 6 years ago

Great!

gvillenave commented 6 years ago

@mannol @kesha-antonov Check out #126 for a fix for the original issue here.