arthenica / ffmpeg-kit

FFmpeg Kit for applications. Supports Android, Flutter, iOS, Linux, macOS, React Native and tvOS. Supersedes MobileFFmpeg, flutter_ffmpeg and react-native-ffmpeg.
https://arthenica.github.io/ffmpeg-kit
GNU Lesser General Public License v3.0
4.5k stars 602 forks source link

Android - Trying to get single frame from mp4 files got unrecognized option #225

Closed fchristysen closed 2 years ago

fchristysen commented 3 years ago

Description I'm trying to get a single frame from .mp4 files and output it as jpg/png in Android. I try the following commands ffmpeg -ss 00:00:06 -i altenburg.mp4 -vframes 1 output.jpeg but failed with ffmpeg-kit. I try the same command in my ubuntu desktop with same .mp4 file and it successfully extract the frame. The version I use in my linux is ffmpeg version 4.2.4-1ubuntu0.1

Expected behavior Output correct image based on frame from the specified time.

Current behavior Got error ffmpeg-kit: Unrecognized option 'vframes 1'. See logs below

To Reproduce Snippet of the code

val command = arrayOf(
                "-i", inputPath,
                "-ss", stringForTime(framePosition),
                "-vframes 1",
                outputPath
            )
            val fFmpegSession = FFmpegKit.execute(command)

Logs

2021-11-05 17:22:28.650 31979-32023/com.traveloka.android.videoedit I/ffmpeg-kit: ffmpeg version v4.5-dev-2008-g90da43557f
2021-11-05 17:22:28.651 31979-32023/com.traveloka.android.videoedit I/ffmpeg-kit:  Copyright (c) 2000-2021 the FFmpeg developers
2021-11-05 17:22:28.652 31979-32023/com.traveloka.android.videoedit I/ffmpeg-kit:   built with Android (7284624, based on r416183b) clang version 12.0.5 (https://android.googlesource.com/toolchain/llvm-project c935d99d7cf2016289302412d708641d52d2f7ee)
2021-11-05 17:22:28.665 31979-32023/com.traveloka.android.videoedit I/ffmpeg-kit:   configuration: --cross-prefix=i686-linux-android- --sysroot=/files/android-sdk/ndk/23.0.7599858/toolchains/llvm/prebuilt/linux-x86_64/sysroot --prefix=/storage/light/projects/ffmpeg-kit/prebuilt/android-x86-lts/ffmpeg --pkg-config=/usr/bin/pkg-config --enable-version3 --arch=i686 --cpu=i686 --cc=i686-linux-android16-clang --cxx=i686-linux-android16-clang++ --ranlib=llvm-ranlib --strip=llvm-strip --nm=llvm-nm --extra-libs='-L/storage/light/projects/ffmpeg-kit/prebuilt/android-x86-lts/cpu-features/lib -lndk_compat' --target-os=android --disable-neon --disable-asm --disable-inline-asm --enable-cross-compile --enable-pic --enable-jni --enable-optimizations --enable-swscale --disable-static --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-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-libdav1d --enable-libkvazaar --enable-libilbc --enable-libopus --enable-libsnappy --enable-libsoxr --enable-libtwolame --enable-libvo-amrwbenc --enable-zlib --enable-mediacodec
2021-11-05 17:22:28.665 31979-32023/com.traveloka.android.videoedit I/ffmpeg-kit:   libavutil      57.  5.100 / 57.  5.100
2021-11-05 17:22:28.665 31979-32023/com.traveloka.android.videoedit I/ffmpeg-kit:   libavcodec     59.  7.103 / 59.  7.103
2021-11-05 17:22:28.666 31979-32023/com.traveloka.android.videoedit I/ffmpeg-kit:   libavformat    59.  5.100 / 59.  5.100
2021-11-05 17:22:28.666 31979-32023/com.traveloka.android.videoedit I/ffmpeg-kit:   libavdevice    59.  0.101 / 59.  0.101
2021-11-05 17:22:28.666 31979-32023/com.traveloka.android.videoedit I/ffmpeg-kit:   libavfilter     8.  9.100 /  8.  9.100
2021-11-05 17:22:28.667 31979-32023/com.traveloka.android.videoedit I/ffmpeg-kit:   libswscale      6.  1.100 /  6.  1.100
2021-11-05 17:22:28.667 31979-32023/com.traveloka.android.videoedit I/ffmpeg-kit:   libswresample   4.  0.100 /  4.  0.100
2021-11-05 17:22:28.667 31979-32023/com.traveloka.android.videoedit E/ffmpeg-kit: Unrecognized option 'vframes 1'.
2021-11-05 17:22:28.667 31979-32023/com.traveloka.android.videoedit E/ffmpeg-kit: Error splitting the argument list: 
2021-11-05 17:22:28.667 31979-32023/com.traveloka.android.videoedit E/ffmpeg-kit: Option not found

Environment

tanersener commented 3 years ago

Can you try by splitting -vframes 1 to -vframes and 1 please?

fchristysen commented 3 years ago

it works, Thanks a lot!

github-actions[bot] commented 2 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.