首页 文章

FFmpeg错误输出文件#0不包含任何流

提问于
浏览
2

我在使用FFmpeg剪切部分视频时遇到错误

以下是我的代码

String[] cmd = {"ffmpeg -ss 0 -i "+mPath+" -t 30 -c copy "+ (Environment.getExternalStorageDirectory().getAbsolutePath()+"/sample.mp4")};
executeCommand(cmd);

Function executeCommand

void executeCommand(String[] cmd) {
    try {
        fFmpeg.execute(cmd, new FFmpegExecuteResponseHandler() {
            @Override
            public void onSuccess(String message) {
                Toast.makeText(VideoFullScreen.this, "finished :" + message, Toast.LENGTH_SHORT).show();
            }

            @Override
            public void onProgress(String message) {

            }

            @Override
            public void onFailure(String message) {
                Log.e("Error",message);
            }

            @Override
            public void onStart() {

            }

            @Override
            public void onFinish() {

            }
        });
    } catch (FFmpegCommandAlreadyRunningException e) {
        e.printStackTrace();
    }
}

Error

ffmpeg版本n3.0.1版权所有(c)2000-2016 FFmpeg开发人员使用gcc 4.8(GCC)配置构建: - target-os = linux --cross-prefix = / home / vagrant / SourceCode / ffmpeg-android / toolchain -android / bin / arm-linux-androideabi-archarch = 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'--ext ra-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输出#0,mp4,到'ffmpeg -ss 0 -i /storage/emulated/0/Video/Demo.mp4 -t 30 -c copy /storage/emulated/0/sample.mp4':输出文件#0不包含任何流

1 回答

  • 4

    这是我自己的问题的答案

    我的问题出在我传递的命令字符串数组中

    这个答案是针对所有人都面临与ffmpeg类似问题的人

    Important things you should follow while using ffmpeg

    • 确保,您正在正确传递命令 String Array
    String[] cmd = {"-ss", "0", "-i" ,input_video_path, "-t" ,"30", "-c", "copy",output_video_path};
    
    • 不要在传递的参数和标志中添加任何 extra space { " -c" 错误}

    • 不要在cmd数组中传递 ffmpeg { "ffmpeg" is 错误}

    希望这会对某人有所帮助

相关问题