ffmpeg-Error splitting the argument list: Option not found

15,819

Solution 1

I faced a very similar issue. The command I gave was

"-y -i /sdcard/Movies/test_video.3gp /sdcard/Movies/test_video.mp4"

And I got following error

Unrecognized option 'y -i /sdcard/Movies/test_video.3gp /sdcard/Movies/test_video.mp4'. Error splitting the argument list: Option not found

The reason was, I was giving my command in a single String. Instead you have to break each command to its own String and provide a String array

val command: List<String> = listOf("-y", "-i", "/sdcard/Movies/test_video.3gp", "/sdcard/Movies/test_video.mp4")

Solution 2

Issue is that the shell command required here needs you to split your string at whitespaces so that there are none.

The easiest way to do that would be :-

String ffmpegCmdString = "-y -i /sdcard/Movies/test_video.3gp /sdcard/Movies/test_video.mp4"

String[] splitCmd = ffmpegCmdString.split(" ");

You can now pass this splitCmd variable to run your command and it will work like a charm.

Share:
15,819
Android Developer
Author by

Android Developer

Updated on June 18, 2022

Comments

  • Android Developer
    Android Developer about 2 years

    I am trying to execute below command using ffmpeg-android-java

    -i /storage/sdcard0/WhatsApp/Media/WhatsApp Video/VID-20170228-WA0000.mp4 -ss 180 -t 292 -strict -2 -async 1 /storage/sdcard0/Movies/cropper_video_1.mp4

    I am getting below failure message-

    FAILED with output : ffmpeg version n3.0.1 Copyright (c) 2000-2016 the FFmpeg developers built with gcc 4.8 (GCC) configuration: --target-os=linux --cross-prefix=/home/vagrant/SourceCode/ffmpeg-android/toolchain-android/bin/arm-linux-androideabi- --arch=arm --cpu=cortex-a8 --enable-runtime-cpudetect --sysroot=/home/vagrant/SourceCode/ffmpeg-android/toolchain-android/sysroot --enable-pic --enable-libx264 --enable-libass --enable-libfreetype --enable-libfribidi --enable-libmp3lame --enable-fontconfig --enable-pthreads --disable-debug --disable-ffserver --enable-version3 --enable-hardcoded-tables --disable-ffplay --disable-ffprobe --enable-gpl --enable-yasm --disable-doc --disable-shared --enable-static --pkg-config=/home/vagrant/SourceCode/ffmpeg-android/ffmpeg-pkg-config --prefix=/home/vagrant/SourceCode/ffmpeg-android/build/armeabi-v7a --extra-cflags='-I/home/vagrant/SourceCode/ffmpeg-android/toolchain-android/include -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -fno-strict-overflow -fstack-protector-all' --extra-ldflags='-L/home/vagrant/SourceCode/ffmpeg-android/toolchain-android/lib -Wl,-z,relro -Wl,-z,now -pie' --extra-libs='-lpng -lexpat -lm' --extra-cxxflags= libavutil 55. 17.103 / 55. 17.103 libavcodec 57. 24.102 / 57. 24.102 libavformat 57. 25.100 / 57. 25.100 libavdevice 57. 0.101 / 57. 0.101 libavfilter 6. 31.100 / 6. 31.100 libswscale 4. 0.100 / 4. 0.100 libswresample 2. 0.101 / 2. 0.101 libpostproc 54. 0.100 / 54. 0.100 Unrecognized option 'i /storage/sdcard0/WhatsApp/Media/WhatsApp Video/VID-20170228-WA0000.mp4 -ss 180 -t 292 -strict -2 -async 1 /storage/sdcard0/Movies/cropper_video_1.mp4'. Error splitting the argument list: Option not found

    Why am i getting this error and how can i resolve it?