tanersener / mobile-ffmpeg

FFmpeg for Android, iOS and tvOS. Not maintained anymore. Superseded by FFmpegKit.
https://tanersener.github.io/mobile-ffmpeg
GNU General Public License v3.0
3.85k stars 787 forks source link

[Android] libwebp create animated webp #706

Closed DonMarv00 closed 3 years ago

DonMarv00 commented 3 years ago

Description Hi guys, I never used ffmpeg, but currently I need it to create a animated webp out of multiple static webp files using libwebp (webpmux). I use Google's offical template codes to generate an animated webp. It would be greate if you could help me :)

Googles template: webpmux -frame 1.webp +100 -frame 2.webp +100+50+50 \ -frame 3.webp +100+50+50+1+b -loop 10 -bgcolor 255,255,255,255 \ -o anim_container.webp

My command

webpmux -frame /storage/emulated/0/Android/data/com.citroncode.playgroundanimatedstickers/files/bm1.webp +100 -frame /storage/emulated/0/Android/data/com.citroncode.playgroundanimatedstickers/files/bm1.webp+100+50+50 \ -frame /storage/emulated/0/Android/data/com.citroncode.playgroundanimatedstickers/files/bm1.webp +100+50+50+1+b -loop 10 -bgcolor 255,255,255,255 \ -o /storage/emulated/0/Android/data/com.citroncode.playgroundanimatedstickers/files/out.webp

Android Studio Code: ` String commandExe = "webpmux -frame /storage/emulated/0/Android/data/com.citroncode.playgroundanimatedstickers/files/bm1.webp +100 -frame /storage/emulated/0/Android/data/com.citroncode.playgroundanimatedstickers/files/bm1.webp+100+50+50 \\n" + "-frame /storage/emulated/0/Android/data/com.citroncode.playgroundanimatedstickers/files/bm1.webp +100+50+50+1+b -loop 10 -bgcolor 255,255,255,255 \\n" + "-o /storage/emulated/0/Android/data/com.citroncode.playgroundanimatedstickers/files/out.webp";

    FFmpeg.executeAsync(commandExe, (executionId1, returnCode) -> {
        Toast.makeText(this, "executed", Toast.LENGTH_SHORT).show();
        if (returnCode == RETURN_CODE_SUCCESS) {
            Toast.makeText(this, "Sucess", Toast.LENGTH_SHORT).show();
        } else if (returnCode == RETURN_CODE_CANCEL) {
            Log.i("FFMPEG ERROR", "Async command execution cancelled by user.");
            Toast.makeText(this, "Async command execution cancelled by user.", Toast.LENGTH_SHORT).show();
        } else {
            Log.i("FFMPEG ERROR", String.format("Async command execution failed with returnCode=%d.", returnCode));
            Toast.makeText(this, String.format("Async command execution failed with returnCode=%d.", returnCode), Toast.LENGTH_SHORT).show();
        }
    });
}`

bm1 and bm2.webp exists in the folder, out.webp not, this will be generated trough ffmpeg right? I also tried some tuturials and splitted the String as an String array because of this error: "2021-03-26 22:13:37.385 27944-28085/com.citroncode.playgroundanimatedstickers E/mobile-ffmpeg: Error splitting the argument list: " Expected behavior animated webp file will be generated in private app folder (getExternalFilesDir(null))

Current behavior execution failed, look at the log for more details

Logs

2021-03-26 22:13:22.518 27944-28006/com.citroncode.playgroundanimatedstickers I/AdrenoGLES-0: Build Config : C P 11.0.1 AArch64 2021-03-26 22:13:22.518 27944-28006/com.citroncode.playgroundanimatedstickers I/AdrenoGLES-0: Driver Path : /vendor/lib64/egl/libGLESv2_adreno.so 2021-03-26 22:13:22.573 27944-28006/com.citroncode.playgroundanimatedstickers I/AdrenoGLES-0: PFP: 0x016ee189, ME: 0x00000000 2021-03-26 22:13:22.620 27944-28006/com.citroncode.playgroundanimatedstickers W/AdrenoUtils: : Failed to open /sys/class/kgsl/kgsl-3d0/gpu_model 2021-03-26 22:13:22.620 27944-28006/com.citroncode.playgroundanimatedstickers W/AdrenoUtils: : Failed to read chip ID from gpu_model. Fallback to use the GSL path 2021-03-26 22:13:22.749 27944-28006/com.citroncode.playgroundanimatedstickers I/Gralloc4: mapper 4.x is not supported 2021-03-26 22:13:22.750 27944-28006/com.citroncode.playgroundanimatedstickers W/Gralloc3: mapper 3.x is not supported 2021-03-26 22:13:23.115 27944-27944/com.citroncode.playgroundanimatedstickers I/Choreographer: Skipped 38 frames! The application may be doing too much work on its main thread. 2021-03-26 22:13:37.043 27944-28083/com.citroncode.playgroundanimatedstickers I/mobile-ffmpeg: Loading mobile-ffmpeg. 2021-03-26 22:13:37.316 27944-28083/com.citroncode.playgroundanimatedstickers I/mobile-ffmpeg: Loaded mobile-ffmpeg-full-gpl-arm64-v8a-4.4-20200725. 2021-03-26 22:13:37.318 27944-28085/com.citroncode.playgroundanimatedstickers D/mobile-ffmpeg: Callback thread started. 2021-03-26 22:13:37.318 27944-28085/com.citroncode.playgroundanimatedstickers I/mobile-ffmpeg: ffmpeg version v4.4-dev-416 2021-03-26 22:13:37.318 27944-28085/com.citroncode.playgroundanimatedstickers I/mobile-ffmpeg: Copyright (c) 2000-2020 the FFmpeg developers 2021-03-26 22:13:37.318 27944-28085/com.citroncode.playgroundanimatedstickers I/mobile-ffmpeg: built with Android (6454773 based on r365631c2) clang version 9.0.8 (https://android.googlesource.com/toolchain/llvm-project 98c855489587874b2a325e7a516b99d838599c6f) (based on LLVM 9.0.8svn) 2021-03-26 22:13:37.319 27944-28085/com.citroncode.playgroundanimatedstickers I/mobile-ffmpeg: configuration: --cross-prefix=aarch64-linux-android- --sysroot=/files/android-sdk/ndk/21.3.6528147/toolchains/llvm/prebuilt/linux-x86_64/sysroot --prefix=/home/taner/Projects/mobile-ffmpeg/prebuilt/android-arm64/ffmpeg --pkg-config=/usr/bin/pkg-config --enable-version3 --arch=aarch64 --cpu=armv8-a --cc=aarch64-linux-android24-clang --cxx=aarch64-linux-android24-clang++ --extra-libs='-L/home/taner/Projects/mobile-ffmpeg/prebuilt/android-arm64/cpu-features/lib -lndk_compat' --target-os=android --enable-neon --enable-asm --enable-inline-asm --enable-cross-compile --enable-pic --enable-jni --enable-optimizations --enable-swscale --enable-shared --enable-v4l2-m2m --disable-outdev=fbdev --disable-indev=fbdev --enable-small --disable-openssl --disable-xmm-clobber-test --disable-debug --enable-lto --disable-neon-clobber-test --disable-programs --disable-postproc --disable-doc --disable-htmlpages --disable-manpages --disable-podpages --disable-txtpages --disable-static --disable-sndio --disable-schannel --disable-securetransport --disable-xlib --disable-cuda --disable-cuvid --disable-nvenc --disable-vaapi --disable-vdpau --disable-videotoolbox --disable-audiotoolbox --disable-appkit --disable-alsa --disable-cuda --disable-cuvid --disable-nvenc --disable-vaapi --disable-vdpau --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-gmp --enable-gnutls --enable-libmp3lame --enable-libass --enable-iconv --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libxml2 --enable-libopencore-amrnb --enable-libshine --enable-libspeex --enable-libwavpack --enable-libkvazaar --enable-libx264 --enable-gpl --enable-libxvid --enable-gpl --enable-libx265 --enable-gpl --enable-libvidstab --enable-gpl --enable-libilbc --enable-libopus --enable-libsnappy --enable-libsoxr --enable-libaom --enable-libtwolame --disable-sdl2 --enable-libvo-amrwbenc --enable-zlib --enable-mediacodec 2021-03-26 22:13:37.320 27944-28085/com.citroncode.playgroundanimatedstickers I/mobile-ffmpeg: libavutil 56. 55.100 / 56. 55.100 2021-03-26 22:13:37.320 27944-28085/com.citroncode.playgroundanimatedstickers I/mobile-ffmpeg: libavcodec 58. 96.100 / 58. 96.100 2021-03-26 22:13:37.320 27944-28085/com.citroncode.playgroundanimatedstickers I/mobile-ffmpeg: libavformat 58. 48.100 / 58. 48.100 2021-03-26 22:13:37.320 27944-28085/com.citroncode.playgroundanimatedstickers I/mobile-ffmpeg: libavdevice 58. 11.101 / 58. 11.101 2021-03-26 22:13:37.320 27944-28085/com.citroncode.playgroundanimatedstickers I/mobile-ffmpeg: libavfilter 7. 87.100 / 7. 87.100 2021-03-26 22:13:37.320 27944-28085/com.citroncode.playgroundanimatedstickers I/mobile-ffmpeg: libswscale 5. 8.100 / 5. 8.100 2021-03-26 22:13:37.320 27944-28085/com.citroncode.playgroundanimatedstickers I/mobile-ffmpeg: libswresample 3. 8.100 / 3. 8.100 2021-03-26 22:13:37.385 27944-28085/com.citroncode.playgroundanimatedstickers E/mobile-ffmpeg: Unrecognized option 'frame'. 2021-03-26 22:13:37.385 27944-28085/com.citroncode.playgroundanimatedstickers E/mobile-ffmpeg: Error splitting the argument list: 2021-03-26 22:13:37.385 27944-28085/com.citroncode.playgroundanimatedstickers E/mobile-ffmpeg: Option not found 2021-03-26 22:13:37.386 27944-27944/com.citroncode.playgroundanimatedstickers D/CompatibilityChangeReporter: Compat change id reported: 147798919; UID 10690; state: ENABLED 2021-03-26 22:13:37.399 27944-27944/com.citroncode.playgroundanimatedstickers I/FFMPEG ERROR: Async command execution failed with returnCode=1.

Environment

DonMarv00 commented 3 years ago

I did by myself I created a gif and converted it using webp_anim codec