FFmpeg错误输出文件#0不包含任何流 [英] FFmpeg error Output file #0 does not contain any stream

查看:757
本文介绍了FFmpeg错误输出文件#0不包含任何流的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用FFmpeg剪切视频的一部分时出现错误

I'm getting an error while cutting a portion of a video using FFmpeg

以下是我的代码

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

函数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();
    }
}

错误

ffmpeg版本n3.0.1版权所有(c)2000-2016 FFmpeg开发人员

ffmpeg version n3.0.1 Copyright (c) 2000-2016 the FFmpeg developers

使用gcc 4.8(GCC)构建

built with gcc 4.8 (GCC)

配置:--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 =

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

libavutil 55. 17.103 / 55. 17.103

libavcodec 57. 24.102/57. 24.102

libavcodec 57. 24.102 / 57. 24.102

libavformat 57. 25.100/57. 25.100

libavformat 57. 25.100 / 57. 25.100

libavdevice 57. 0.101/57. 0.101

libavdevice 57. 0.101 / 57. 0.101

libavfilter 6. 31.100/6. 31.100

libavfilter 6. 31.100 / 6. 31.100

libswscale 4. 0.100/4. 0.100

libswscale 4. 0.100 / 4. 0.100

libswresample 2. 0.101/2. 0.101

libswresample 2. 0.101 / 2. 0.101

libpostproc 54. 0.100/54. 0.100

libpostproc 54. 0.100 / 54. 0.100

将#0,mp4输出到'ffmpeg -ss 0 -i/storage/emulated/0/Video/Demo.mp4 -t 30 -c复制/storage/emulated/0/sample.mp4':

Output #0, mp4, to 'ffmpeg -ss 0 -i /storage/emulated/0/Video/Demo.mp4 -t 30 -c copy /storage/emulated/0/sample.mp4':

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

Output file #0 does not contain any stream

推荐答案

这是我自己的问题的答案

This is an answer to my own question

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

My problem was in the command string array i was passing

这个答案是给所有都遇到与ffmpeg

使用ffmpeg

Important things you should follow while using ffmpeg

  1. 请确保您在正确的String Array

String[] cmd = {"-ss", "0", "-i" ,input_video_path, "-t" ,"30", "-c", "copy",output_video_path};

  • 请勿在传递的参数和标志中添加任何extra space {" -c"是错误的}

  • Do not add any extra space in arguments and flags you are passing {" -c" is wrong }

    希望这对某人有帮助

    这篇关于FFmpeg错误输出文件#0不包含任何流的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

  • 查看全文
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆