AbedElazizShe / LightCompressor

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

Always compressing 32.0 Bytes #79

Closed wnsxor07 closed 3 years ago

wnsxor07 commented 3 years ago

I use Video Compressor class. But It always compressing 32.0 Bytes.

This is my code.

`Uri uri = Uri.parse(filePath); VideoCompressor.start( getApplicationContext(), uri, filePath, desFile.getAbsolutePath(), new CompressionListener() { @Override public void onStart() { Trace.Debug("++ onStart()"); }

                            @Override
                            public void onSuccess() {
                                Trace.Debug("++ onSuccess()");
                                Trace.Debug(">> file.length() = " + desFile.length());
                            }

                            @Override
                            public void onFailure(@NotNull String s) {
                                Trace.Debug("++ onFailure()");
                                Trace.Debug(">> String s = " + s.toString());
                            }

                            @Override
                            public void onProgress(float v) {
                                Trace.Debug("++ onProgress()");
                            }

                            @Override
                            public void onCancelled() {
                                Trace.Debug("++ onCancelled()");
                            }
                        }, VideoQuality.MEDIUM, false, false
                );`

How to get collect compressing :?

DevPraly commented 3 years ago

Hi, same issue for me. Callback onSuccess is called but every video is compressed to 32B file. Compressor Config is: new Configuration( VideoQuality.LOW, false, false, 960.0 , 540.0, null)

AbedElazizShe commented 3 years ago

Thank you for opening this issue. It is most probably related to how you handle the destination file. Do you see any error messages on the log? Could you please try the sample app? You can find the link on README. In addition, you can have a look at this method to save the video https://github.com/AbedElazizShe/LightCompressor/blob/1584ab39206d3b10a18ece0f2dec836ad6812015/app/src/main/java/com/abedelazizshe/lightcompressor/MainActivity.kt#L211.

If that is all fine, could you please share the Android version and the Android device you're using so I can try to reproduce the issue and fix it. As you may know, the library uses MediaCodec which could produce different behaviours on different phones.

Looking forward for your reply @DevPraly @wnsxor07

AbedElazizShe commented 3 years ago

Please try in version 0.9.3. I think it should be handled.

DevPraly commented 3 years ago

Hi, I can confirm the bug is fixed in 0.9.3. Compile/target sdk 30, running on android 10

Thanks !

namitshah commented 3 years ago

Hi, I am using version 0.9.0 because somehow the classes are not being imported in v0.9.3. I am getting the same behaviour (success() called and a 32B video file being created). I am testing the app on an Android 7 device and am getting a 'libwvm.so not found' message in the error logs which I believe is something related to audio processing.

AbedElazizShe commented 3 years ago

@namitshah why the classes are not being imported? could you please share the error messages?

namitshah commented 3 years ago

@AbedElazizShe, There seems to be an issue with Gradle Installation in version 0.9.3, as many classes and interfaces such as VideoCompressor, VideoQuality and CompressionListener are not present in the final installed package. I am trying to use these classes in Java, and as most of these have been written in Kotlin, it is possible that they are not accessible because of this (an issue with Java class generation?). This same thing also happens with versions 0.9.1 and 0.9.2. However, when I install version 0.9.0, all of these classes are suddenly accessible.

Should I post this as a new issue or continue the conversation here?