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
188 stars 73 forks source link

Compressing seems to never stop #14

Closed kamami closed 5 years ago

kamami commented 5 years ago

When compressing a second video after compressing the first one, I get following Error:

Already have a compression process, you need to wait for the process to finish

It seems that the compression process of the first video is still in progress. Does it not stop automatically? Do I need to stop it manually by calling _stopCompress() ?

Thanks for your help!

rurico commented 5 years ago

You can call _flutterVideoCompress.isCompressing for check. Or use the following example to confirm the compression progress.

_subscription =  _flutterVideoCompress.compressProgress$.subscribe((progress) {
  print('progress: $progress');
});

Currently does not support concurrency, the compression on the phone will be very slow, I think this is not difficult to understand :)

kamami commented 5 years ago

Mhh ok, but why did you not do that in your own example file? I mean, this problem occurs when I run your project. I did not change a bit of your code, just cloned it, ran and captured some videos in a row. First time everything works fine, second time:

Already have a compression process, you need to wait for the process to finish

No hate, just some feedback :) Great job with this project btw!

kamami commented 5 years ago

I checked it a bit more in detail and it seems to occure mainly when picking a video out of the gallery. First time is working fine, second time the compressing process is not starting (no progress in the console, just: Running publishing updates method) third time throwing the error I mentioned above.

rurico commented 5 years ago

Thanks for your feedback, maybe some of the places I tested are not very detailed. I want to know the code associated with gallery.

kamami commented 5 years ago

I just changed the datasource and let everything else untouched:

File file = await ImagePicker.pickVideo(source: ImageSource.gallery);

kamami commented 5 years ago

I did some research and found this:

https://stackoverflow.com/questions/40070987/android-ffmpeg-do-nothing

The second answer is really interesting!

rurico commented 5 years ago

You want to say about overwrite the existing file?

kamami commented 5 years ago

Yes exactly! In my testing, when selecting a new video from gallery to compress, it is working fine in most cases. But when testing with always the same video, the compression seems not to start. Could be just coincident, but meybe thats the reason.

rurico commented 5 years ago

This is not associated with FFmpeg, I judged in the code whether the file exists. . .