lalongooo / video-compressor

Video compressor based in the Telegram for Android app source code.
GNU General Public License v2.0
262 stars 88 forks source link

crash on android 4.2.2 (API 17) #5

Open trantung998 opened 8 years ago

trantung998 commented 8 years ago

i have an error when run on android 4.2.2, this is log:

11-18 18:20:15.321 20575-21673/com.lalongooo.videocompressor W/dalvikvm: No implementation found for native Lorg/telegram/Utilities;.convertVideoFrame:(Ljava/nio/ByteBuffer;Ljava/nio/ByteBuffer;IIIII)I
11-18 18:20:15.346 20575-21673/com.lalongooo.videocompressor E/tmessages: time = 465
11-18 18:20:15.346 20575-21673/com.lalongooo.videocompressor W/dalvikvm: threadid=12: thread exiting with uncaught exception (group=0x415b8a08)
11-18 18:20:15.356 20575-21673/com.lalongooo.videocompressor E/AndroidRuntime: FATAL EXCEPTION: AsyncTask #1
11-18 18:20:15.356 20575-21673/com.lalongooo.videocompressor E/AndroidRuntime: java.lang.RuntimeException: An error occured while executing doInBackground()
11-18 18:20:15.356 20575-21673/com.lalongooo.videocompressor E/AndroidRuntime:     at android.os.AsyncTask$3.done(AsyncTask.java:299)
11-18 18:20:15.356 20575-21673/com.lalongooo.videocompressor E/AndroidRuntime:     at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:352)
11-18 18:20:15.356 20575-21673/com.lalongooo.videocompressor E/AndroidRuntime:     at java.util.concurrent.FutureTask.setException(FutureTask.java:219)
11-18 18:20:15.356 20575-21673/com.lalongooo.videocompressor E/AndroidRuntime:     at java.util.concurrent.FutureTask.run(FutureTask.java:239)
11-18 18:20:15.356 20575-21673/com.lalongooo.videocompressor E/AndroidRuntime:     at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:230)
11-18 18:20:15.356 20575-21673/com.lalongooo.videocompressor E/AndroidRuntime:     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080)
11-18 18:20:15.356 20575-21673/com.lalongooo.videocompressor E/AndroidRuntime:     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:573)
11-18 18:20:15.356 20575-21673/com.lalongooo.videocompressor E/AndroidRuntime:     at java.lang.Thread.run(Thread.java:864)
11-18 18:20:15.356 20575-21673/com.lalongooo.videocompressor E/AndroidRuntime:  Caused by: java.lang.UnsatisfiedLinkError: Native method not found: org.telegram.Utilities.convertVideoFrame:(Ljava/nio/ByteBuffer;Ljava/nio/ByteBuffer;IIIII)I
11-18 18:20:15.356 20575-21673/com.lalongooo.videocompressor E/AndroidRuntime:     at org.telegram.Utilities.convertVideoFrame(Native Method)
11-18 18:20:15.356 20575-21673/com.lalongooo.videocompressor E/AndroidRuntime:     at com.lalongooo.videocompressor.video.MediaController.convertVideo(MediaController.java:590)
11-18 18:20:15.356 20575-21673/com.lalongooo.videocompressor E/AndroidRuntime:     at com.lalongooo.videocompressor.MainActivity$VideoCompressor.doInBackground(MainActivity.java:131)
11-18 18:20:15.356 20575-21673/com.lalongooo.videocompressor E/AndroidRuntime:     at com.lalongooo.videocompressor.MainActivity$VideoCompressor.doInBackground(MainActivity.java:120)
11-18 18:20:15.356 20575-21673/com.lalongooo.videocompressor E/AndroidRuntime:     at android.os.AsyncTask$2.call(AsyncTask.java:287)
11-18 18:20:15.356 20575-21673/com.lalongooo.videocompressor E/AndroidRuntime:     at java.util.concurrent.FutureTask.run(FutureTask.java:234)
11-18 18:20:15.356 20575-21673/com.lalongooo.videocompressor E/AndroidRuntime:     at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:230) 
11-18 18:20:15.356 20575-21673/com.lalongooo.videocompressor E/AndroidRuntime:     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080) 
11-18 18:20:15.356 20575-21673/com.lalongooo.videocompressor E/AndroidRuntime:     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:573) 
11-18 18:20:15.356 20575-21673/com.lalongooo.videocompressor E/AndroidRuntime:     at java.lang.Thread.run(Thread.java:864) 

i think it needs load the native lib for convertVideoFrame fuction

lalongooo commented 8 years ago

Do you have the NDK installed? }

devesh1991 commented 8 years ago

If library is already compiled then no need to USE NDK.

I am getting same error even in your sample. please help us to resolve the problem

TheSikh commented 8 years ago

You have to compile the .so file again if you move or rename the java class in which native method is declared you need to change the corresponding native method name in c file. In our case we have video.c file in jni folder. We need to update the method name according to the package name of java class which will be using this method and also adding "Java_" as prefix to method name. Hope this Help.

Thanks.

lalongooo commented 8 years ago

Thanks for your comments @deep7964. @trantung998, please give it a try.. :grin:

trantung998 commented 8 years ago

thank you @deep7964 , it works and i have another problem "Green bar in compressed videos"

http://telegram.wiki/tips:androidvideocompression

devesh1991 commented 8 years ago

I am still getting same crash on 4.2.2

lalongooo commented 8 years ago

Have you tried the @deep7964 solution?

devesh1991 commented 8 years ago

I tried to compile but getting error of some imports, include file. I am using Ndk Revision 10d. I request you to compile at your side

fbcbl commented 8 years ago

I also have this problem:

In file included from /Users/fabiocarballo/VideoCompressor/app/src/main/jni/./libjpeg/armv6_idct.S:63:0:
/Users/fabiocarballo/Documents/android-ndk-r10/platforms/android-L/arch-arm/usr/include/machine/cpu-features.h:52:6: error: #error Unknown or unsupported ARM architecture
 #    error Unknown or unsupported ARM architecture
      ^
make: *** [/Users/fabiocarballo/VideoCompressor/app/src/main/obj/local/armeabi/objs/tmessages.7/./libjpeg/armv6_idct.o] Error 1

Im using the latest ndk (10) to compile. Do you have any idea on how to solve this? @lalongooo

lalongooo commented 8 years ago

@deep7964 @fabiocarballo I'll reopen this issue and take a look later :smile:

dineshswaas commented 7 years ago

@trantung998 , use below width and height for " Green bar issuee....." . its works for me... int resultWidth = 960; int resultHeight = 640; thanks ...... :) happy coding....

TxShon commented 7 years ago

how do you compile the .so file again @deep7964,when i compile it, i got 'opus.h' file not found error.