AbedElazizShe / LightCompressor

A powerful and easy-to-use video compression library for android uses MediaCodec API.
Apache License 2.0
524 stars 116 forks source link

unexpected CodecException when working on large files #111

Closed AlirezaGhanbarinia closed 2 years ago

AlirezaGhanbarinia commented 2 years ago

Hi when I use this library in my project , I face an exception of type CodecException in the following place:

Compressor -> encoder.configure

and with following message :

mDiagnosticInfo : android.media.MediaCodec.error_neg_5001 detailMessage : Error 0xffffec77

When occurring the mentioned exception, onSuccess method of CompressionListener is called with the size 0!

Mentioned problem happens when working with large videos not the small ones. The information of one of them is mentioned below: resolution: 1920*1080 size: 2.6 GB

AbedElazizShe commented 2 years ago

@AlirezaGhanbarinia thank you for opening the issue. I certainly haven't tried videos that big :). Can you confirm it is mp4? And does it happen on all testing devices you used?

Thank you

AlirezaGhanbarinia commented 2 years ago

I'm really confused, why this happened when use this library in demo all of process is done , but when I use this library in my project I face an exception

I am using a video taken from the camera of this phone and which has the mp4 extension , same library and same configuration on both project

I wonder when I face a exception why callback return "onSuccess" method

AlirezaGhanbarinia commented 2 years ago

I realized that the problem is related to which part, I propose my solution, maybe it will be useful for one person

When using ExoPlayer next to Mediacodec in a fragment or activity, to use Mediacodec , the player release commands must be called

This problem is more common in Samsung phones

AbedElazizShe commented 2 years ago

Thank you @AlirezaGhanbarinia