rurico / flutter_video_compress

Generate a new file by compressed video, and provide metadata. Get video thumbnail from a video path, supports JPEG/GIF. To reduce app size not using FFmpeg in IOS.
MIT License
185 stars 72 forks source link

[Bug] App crash when selecting video from gallery #91

Open agavrel opened 3 years ago

agavrel commented 3 years ago

Description

The app crashes with the example provided (logs below).

Platform

Android Emulator

Backtracking step (if has)

  1. Used example main file with dependencies video_player: ^0.10.11+2, image_picker: ^0.6.7+4 and flutter_video_compress: ^0.3.7+8
  2. 'select video from gallery'
  3. then select video that I downloaded here: https://pixabay.com/videos/atoms-electrons-logo-logo-animation-13232/ and click on confirm
  4. crash

Log

 FATAL EXCEPTION: main
E/AndroidRuntime(15143): java.lang.RuntimeException: setDataSource failed: status = 0x80000000
E/AndroidRuntime(15143):        at android.media.MediaMetadataRetriever.setDataSource(Native Method)
E/AndroidRuntime(15143):        at android.media.MediaMetadataRetriever.setDataSource(MediaMetadataRetriever.java:74)
E/AndroidRuntime(15143):        at android.media.MediaMetadataRetriever.setDataSource(MediaMetadataRetriever.java:162)
E/AndroidRuntime(15143):        at com.example.flutter_video_compress.Utility.getMediaInfoJson(Utility.kt:38)
E/AndroidRuntime(15143):        at com.example.flutter_video_compress.FFmpegCommander$compressVideo$1.onFinish(FFmpegCommander.kt:83)
E/AndroidRuntime(15143):        at nl.bravobit.ffmpeg.FFcommandExecuteAsyncTask.onPostExecute(FFcommandExecuteAsyncTask.java:77)
E/AndroidRuntime(15143):        at nl.bravobit.ffmpeg.FFcommandExecuteAsyncTask.onPostExecute(FFcommandExecuteAsyncTask.java:12)
E/AndroidRuntime(15143):        at android.os.AsyncTask.finish(AsyncTask.java:695)
E/AndroidRuntime(15143):        at android.os.AsyncTask.access$600(AsyncTask.java:180)
E/AndroidRuntime(15143):        at android.os.AsyncTask$InternalHandler.handleMessage(AsyncTask.java:712)
E/AndroidRuntime(15143):        at android.os.Handler.dispatchMessage(Handler.java:106)
E/AndroidRuntime(15143):        at android.os.Looper.loop(Looper.java:193)
E/AndroidRuntime(15143):        at android.app.ActivityThread.main(ActivityThread.java:6669)
E/AndroidRuntime(15143):        at java.lang.reflect.Method.invoke(Native Method)
E/AndroidRuntime(15143):        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
E/AndroidRuntime(15143):        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)

Expected solution

Well should be working for basic examples ?

sharansingh00002 commented 3 years ago

@agavrel even I got the same error, its not actually because of flutter_video_compress, but because of Image picker which is returning even video files with jpg extension in Android

sharansingh00002 commented 3 years ago

https://github.com/flutter/plugins/pull/2860 Refer this PR and make the changes it will work then

agavrel commented 3 years ago

Good catch. Well this is the base example so we should not have to make tweaks to make it work. I hope they (image_picker) can accept the PR asap

jawa0919 commented 3 years ago

flutter/plugins#2860 Refer this PR and make the changes it will work then

change image_picker fix https://github.com/flutter/plugins/pull/2860#issuecomment-669382091

jpetro416 commented 3 years ago

This needs to be fixed ASAP!

Akshay-akkay commented 3 years ago

flutter/plugins#2860 Refer this PR and make the changes it will work then

change image_picker fix flutter/plugins#2860 (comment)

Help. Pub giving this error on using the comment's advise.

pub get failed (server unavailable) -- attempting retry 2 in 2 seconds...

Git error. Command: git rev-list --max-count=1 9cac5347d9ab9d111a918a8154fb060565b1bf31

stdout:

stderr: fatal: bad object 9cac5347d9ab9d111a918a8154fb060565b1bf31

exit code: 128

sudooobro commented 3 years ago

flutter/plugins#2860 Refer this PR and make the changes it will work then

change image_picker fix flutter/plugins#2860 (comment)

Help. Pub giving this error on using the comment's advise.

pub get failed (server unavailable) -- attempting retry 2 in 2 seconds...

Git error. Command: git rev-list --max-count=1 9cac5347d9ab9d111a918a8154fb060565b1bf31

stdout:

stderr: fatal: bad object 9cac5347d9ab9d111a918a8154fb060565b1bf31

exit code: 128

Same error