ffmpeg - 分割参数列表时出错:找不到选项

时间:2017-03-01 12:44:54

标签: android video ffmpeg

我正在尝试使用ffmpeg-android-java

执行以下命令
  

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

我收到失败信息 -

  

输出失败:ffmpeg版本n3.0.1版权所有(c)2000-2016   FFmpeg开发人员                                                                                                 用gcc 4.8(GCC)构建                                                                                                 配置: - target-os = linux   --cross前缀= /家庭/流浪者/源码/ ffmpeg的-的Android /工具链功能的Android /斌/ 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 =' - 我的/ home /流浪者/源码/ ffmpeg的-的Android /工具链功能的Android /包括   -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE = 2 -fno-strict-overflow -fstack-protector-all' --extra-LDFLAGS =' -L /家/流浪/源码/ ffmpeg的-机器人/工具链-机器人/ lib中   -Wl,-z,relro -Wl,-z,现在-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                                                                                               无法识别的选项' i / storage / sdcard0 / WhatsApp / Media / WhatsApp   视频/ VID-20170228-WA0000.mp4 -ss 180 -t 292 -strict -2 -async 1   /storage/sdcard0/Movies/cropper_video_1.mp4' ;.                                                                                               拆分参数列表时出错:未找到选项

为什么我会收到此错误,我该如何解决?

3 个答案:

答案 0 :(得分:1)

我遇到了一个非常相似的问题。我给的命令是

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

我收到以下错误

  

无法识别的选项'y -i /sdcard/Movies/test_video.3gp   /sdcard/Movies/test_video.mp4”。拆分参数列表时出错:   找不到选项

原因是,我在单个String中给出了命令。取而代之的是,您必须将每个命令分解为自己的String并提供一个String数组

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

答案 1 :(得分:1)

问题是,此处所需的shell命令需要您在空格处分割字符串,以便不存在空格。

最简单的方法是:-

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

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

您现在可以传递此splitCmd变量来运行命令,它将像超级按钮一样工作。

答案 2 :(得分:0)

这意味着ffmpeg的某些功能尚未完全为此版本实现。 解决方案: 1.为Android的ffmpeg创建自定义构建。 2.删除-strict -2 -async 1标志