jonataslaw / VideoCompress

Compress videos, remove audio, manipulate thumbnails, and make your video compatible with all platforms through this lightweight and efficient library.
MIT License
217 stars 242 forks source link

"VideoCompress.getFileThumbnail()" function not able to create thumbnail image and showing error #89

Open kamleshwebtech opened 3 years ago

kamleshwebtech commented 3 years ago

I have a video in android actual device at

Video path: "/storage/emulated/0/TechApp/Storage/Media/Images/LegzTInQbasdvCc2kYy9.mp4"

but "VideoCompress.getFileThumbnail()" function is not able to create a thumbnail image and showing error in console panel:

Launching lib\main.dart on Redmi Note 4 in debug mode...
 lib\main.dart
√ Built build\app\outputs\flutter-apk\app-debug.apk.
Connecting to VM Service at ws://127.0.0.1:55630/04Sixg3aL6U=/ws
I/CameraManagerGlobal(18870): Connecting to camera service
V/BoostFramework(18870): BoostFramework() : mPerf = com.qualcomm.qti.Performance@35e5cfa
I/flutter (18870): length: 5 = 3
I/flutter (18870): video path: /storage/emulated/0/TechApp/Storage/Media/Images/LegzTInQbasdvCc2kYy9.mp4
I/flutter (18870): Error from VideoCompress:
I/flutter (18870):       Method: getFileThumbnail
I/flutter (18870):       PlatformException(video_compress, Assume this is a corrupt video file, null, null)
E/MethodChannel#video_compress(18870): Failed to handle method call
E/MethodChannel#video_compress(18870): java.lang.IllegalArgumentException: Unsupported value: [Ljava.lang.Integer;@5d60520
E/MethodChannel#video_compress(18870):  at io.flutter.plugin.common.StandardMessageCodec.writeValue(StandardMessageCodec.java:276)
E/MethodChannel#video_compress(18870):  at io.flutter.plugin.common.StandardMethodCodec.encodeSuccessEnvelope(StandardMethodCodec.java:59)
E/MethodChannel#video_compress(18870):  at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler$1.success(MethodChannel.java:238)
E/MethodChannel#video_compress(18870):  at com.example.video_compress.Utility.getBitmap(Utility.kt:98)
E/MethodChannel#video_compress(18870):  at com.example.video_compress.ThumbnailUtility.getFileThumbnail(ThumbnailUtility.kt:25)
E/MethodChannel#video_compress(18870):  at com.example.video_compress.VideoCompressPlugin.onMethodCall(VideoCompressPlugin.kt:58)
E/MethodChannel#video_compress(18870):  at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:233)
E/MethodChannel#video_compress(18870):  at io.flutter.embedding.engine.dart.DartMessenger.handleMessageFromDart(DartMessenger.java:85)
E/MethodChannel#video_compress(18870):  at io.flutter.embedding.engine.FlutterJNI.handlePlatformMessage(FlutterJNI.java:738)
E/MethodChannel#video_compress(18870):  at android.os.MessageQueue.nativePollOnce(Native Method)
E/MethodChannel#video_compress(18870):  at android.os.MessageQueue.next(MessageQueue.java:329)
E/MethodChannel#video_compress(18870):  at android.os.Looper.loop(Looper.java:142)
E/MethodChannel#video_compress(18870):  at android.app.ActivityThread.main(ActivityThread.java:6375)
E/MethodChannel#video_compress(18870):  at java.lang.reflect.Method.invoke(Native Method)
E/MethodChannel#video_compress(18870):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:912)
E/MethodChannel#video_compress(18870):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:802)
E/DartMessenger(18870): Uncaught exception in binary message listener
E/DartMessenger(18870): java.lang.IllegalStateException: Reply already submitted
E/DartMessenger(18870):     at io.flutter.embedding.engine.dart.DartMessenger$Reply.reply(DartMessenger.java:155)
E/DartMessenger(18870):     at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:253)
E/DartMessenger(18870):     at io.flutter.embedding.engine.dart.DartMessenger.handleMessageFromDart(DartMessenger.java:85)
E/DartMessenger(18870):     at io.flutter.embedding.engine.FlutterJNI.handlePlatformMessage(FlutterJNI.java:738)
E/DartMessenger(18870):     at android.os.MessageQueue.nativePollOnce(Native Method)
E/DartMessenger(18870):     at android.os.MessageQueue.next(MessageQueue.java:329)
E/DartMessenger(18870):     at android.os.Looper.loop(Looper.java:142)
E/DartMessenger(18870):     at android.app.ActivityThread.main(ActivityThread.java:6375)
E/DartMessenger(18870):     at java.lang.reflect.Method.invoke(Native Method)
E/DartMessenger(18870):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:912)
E/DartMessenger(18870):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:802)
E/flutter (18870): [ERROR:flutter/lib/ui/ui_dart_state.cc(177)] Unhandled Exception: Invalid argument(s) (path): Must not be null
E/flutter (18870): #0      ArgumentError.checkNotNull (dart:core/errors.dart:194:27)
E/flutter (18870): #1      _File._checkNotNull (dart:io/file_impl.dart:641:19)
E/flutter (18870): #2      new _File (dart:io/file_impl.dart:205:17)
E/flutter (18870): #3      new File (dart:io/file.dart:250:18)
E/flutter (18870): #4      Compress.getFileThumbnail
 package:video_compress/…/video_compress/video_compressor.dart
E/flutter (18870): <asynchronous suspension>
E/flutter (18870): #5      MasterFunctions.getVideoUrlToThumbUrl
 package:whatsupflutter/vendor/Masterfunctions.dart
E/flutter (18870): <asynchronous suspension>
E/flutter (18870): #6      _UserMediaHomeScreenState._fetchGalleryFiles.<anonymous closure>
 package:whatsupflutter/…/usermediatabs/UserMediaHomeScreen.dart
E/flutter (18870): <asynchronous suspension>
E/flutter (18870): #7      _UserMediaHomeScreenState._fetchGalleryFiles
 package:whatsupflutter/…/usermediatabs/UserMediaHomeScreen.dart
E/flutter (18870): <asynchronous suspension>
E/flutter (18870):

BTW I have checked this function with multiple videos but results are same. Kindly suggest what is the issue and how can we fix it. Thanks a lot.

MaxSchilling commented 3 years ago

I am facing the same, any update here?

qq326646683 commented 2 years ago

+1

qq326646683 commented 2 years ago

I fix this bug (MediaMetadataRetriever setDataSource IllegalArgumentException) by change the name of video

qq326646683 commented 2 years ago

the name can not work : "image_picker6769544639684925184_trimmed:Dec16,2021-16:05:42.mp4"

hbrhbr commented 2 years ago

I fix this bug (MediaMetadataRetriever setDataSource IllegalArgumentException) by change the name of video

I was getting same issue...and resolve by changing file name.. Thanks

marianoarga commented 2 years ago

Im not saving the files as ".mp4" so I can't evade this issue, I must change the file name, run the compress, and rename again...