[FFmpeg-user] Query related to FFMpeg-kit Android

Ferdi Scholten ferdi at sttc-nlp.nl
Wed Jun 5 20:55:15 EEST 2024


Hi,
> I am developing a feature in my Android application where I want to
> generate the video thumbnail of HLS video.
> I tried to generate the thumbnail using
> Android native MediaMetadataRetriever but it failed for HLS video so that
> is the reason I have decided to use FFMpeg and the only feature I want to
> use is to generate thumbnails for HLS videos.
>
> I have tried adding the gradle dependency into my app and it's working as
> expected.
> implementation("com.arthenica:ffmpeg-kit-https:6.0-2.LTS")
>
> The problem here is that the above dependency increases my APK size
> tremendously, previously my APK size was approximately 30 MB and after
> adding the above dependency the apk size increases to 130 MB.
>
> In order to reduce the APK size I have decided to build and generate the
> .aar file manually and include only those architecture and libraries which
> are must.
> I don't have much knowledge in generating the .aar file but after following
> the documentation I generated it successfully and added it to my project
> but it crashed the app start.
>
> Now based on my requirement can you please suggest what all libraries
> should I include in the aar build process so that the apk size doesn't
> increase and can generate the thumbnail from HLS video.
> ./android.sh --lts --enable-gpl --enable-gmp --enable-x264 --enable-x265
> --enable-xvidcore --disable-arm-v7a-neon --disable-arm-v7a
> --disable-arm-v7a-neon --disable-arm64-v8a --disable-x86
>
>
> Crash:
>   java.lang.Error: FFmpegKit failed to start on brand: google, model: Pixel
> 6, device: oriole, api level: 34, abis: arm64-v8a armeabi-v7a armeabi,
> 32bit abis: armeabi-v7a armeabi, 64bit abis: arm64-v8a.
>                    at
> com.arthenica.ffmpegkit.NativeLoader.loadLibrary(NativeLoader.java:50)
>                    at
> com.arthenica.ffmpegkit.NativeLoader.loadFFmpegKitAbiDetect(NativeLoader.java:130)
>                    at
> com.arthenica.ffmpegkit.AbiDetect.<clinit>(AbiDetect.java:30)
>                    at
> com.arthenica.ffmpegkit.NativeLoader.loadNativeAbi(NativeLoader.java:65)
>                    at
> com.arthenica.ffmpegkit.NativeLoader.loadFFmpegKit(NativeLoader.java:173)
>                    at
> com.arthenica.ffmpegkit.FFmpegKitConfig.<clinit>(FFmpegKitConfig.java:145)
>                    at
> com.arthenica.ffmpegkit.FFmpegKit.execute(FFmpegKit.java:167)
>                    at
> com.example.videoplayertest.Thumbnail.generateThumbnailFromHls(Thumbnail.kt:25)
>                    at
> com.example.videoplayertest.Thumbnail.test(Thumbnail.kt:16)
>                    at
> com.example.videoplayertest.ComposableSingletons$MainActivityKt$lambda-1$1$1$1.invokeSuspend(MainActivity.kt:56)
>                    at
> kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
>                    at
> kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:108)
>                    at
> kotlinx.coroutines.internal.LimitedDispatcher$Worker.run(LimitedDispatcher.kt:115)
>                    at
> kotlinx.coroutines.scheduling.TaskImpl.run(Tasks.kt:103)
>                    at
> kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:584)
>                    at
> kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:793)
>                    at
> kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:697)
>                    at
> kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:684)
>                    Suppressed:
> kotlinx.coroutines.internal.DiagnosticCoroutineContextException:
> [androidx.compose.ui.platform.MotionDurationScaleImpl at 8931557,
> androidx.compose.runtime.BroadcastFrameClock at f6ac844,
> StandaloneCoroutine{Cancelling}@2142d2d, Dispatchers.IO]
>                   Caused by: java.lang.UnsatisfiedLinkError: dlopen failed:
> library "libffmpegkit_abidetect.so" not found
>                    at java.lang.Runtime.loadLibrary0(Runtime.java:1082)
>                    at java.lang.Runtime.loadLibrary0(Runtime.java:1003)
>                    at java.lang.System.loadLibrary(System.java:1661)
>                    at
> com.arthenica.ffmpegkit.NativeLoader.loadLibrary(NativeLoader.java:48)
>
> Thanks & Regards,
> Ashwin Khadgi
> +91-8055722995

Instead of reinventing the wheel, you could try ffmpegthumbnailer
https://github.com/dirkvdb/ffmpegthumbnailer


More information about the ffmpeg-user mailing list