maitrungduc1410 / react-native-video-trim

Video trimmer for React Native App
MIT License
37 stars 14 forks source link

Error when using react-native-video-trim along with ffmpeg-kit-react-native v6.0.2 #19

Closed AnsOfficial closed 5 months ago

AnsOfficial commented 5 months ago

I using ffmpeg-kit-react-native for encoding and lower quality of videos on android. but when using react-native-video-trim it give an error:

JNI DETECTED ERROR IN APPLICATION: JNI NewByteArray called with pending exception java.lang.NoSuchMethodError: No virtual method getTime()I in class Lcom/arthenica/ffmpegkit/Statistics; or its super classes (declaration of 'com.arthenica.ffmpegkit.Statistics' appears in /data/app/~~RN1torJ38b6GAsygUwTq5w==/com.sorrowplace.app-eik-x_bK7Nazy0ZTdCQ7FA==/base.apk) at void com.videotrim.utils.VideoTrimmerUtil.lambda$trim$2(int, com.videotrim.interfaces.VideoTrimListener, com.arthenica.ffmpegkit.Statistics) (VideoTrimmerUtil.java:62)

I this its because of the conflicting versions of ffmpeg used.

@maitrungduc1410

maitrungduc1410 commented 5 months ago

my package is using v5.1.0

if possible can you try to use RN version which is compatible with 5.1.0?

https://github.com/arthenica/ffmpeg-kit/releases/tag/react.native.v5.1.0

AnsOfficial commented 5 months ago

my package is using v5.1.0

if possible can you try to use RN version which is compatible with 5.1.0?

https://github.com/arthenica/ffmpeg-kit/releases/tag/react.native.v5.1.0

yup downgrading to 5.1 worked. Thanks 🥳

AnsOfficial commented 5 months ago

my package is using v5.1.0

if possible can you try to use RN version which is compatible with 5.1.0?

https://github.com/arthenica/ffmpeg-kit/releases/tag/react.native.v5.1.0

hi, further testing on newer device (latest NDK): it crashes the app on lunch because 5.1 don't support the newer NDKs. is there an way to exclude my version of ffmpeg from react-native-video-trim so that conflict is removed. Thanks @maitrungduc1410

maitrungduc1410 commented 5 months ago

I'll push an update to support this

maitrungduc1410 commented 5 months ago

Please upgrade to 1.0.9. upgraded to FFMPEG Kit v6

Now by default:

In your case you need to use exact same version for both, in your android/build.gradle > buildscript > ext. set ffmpegKitPackage = "min" use min for both library, or any other versions as described here: https://github.com/arthenica/ffmpeg-kit#9-packages

buildscript {
    ext {
        ffmpegKitPackage = "min"
    }
AnsOfficial commented 5 months ago

Please upgrade to 1.0.9. upgraded to FFMPEG Kit v6

Now by default:

  • RN video trim uses min version for smallest bundle size
  • RN FFMPEG (yours) uses https version

In your case you need to use exact same version for both, in your android/build.gradle > buildscript > ext. set ffmpegKitPackage = "min" use min for both library, or any other versions as described here: https://github.com/arthenica/ffmpeg-kit#9-packages

buildscript {
    ext {
        ffmpegKitPackage = "min"
    }

Worked perfectly ❤️ thanks alot