Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android ffmpeg Output Error

I am using

https://github.com/writingminds/ffmpeg-android-java

to run ffmpeg commands on android. I am trying to overlay an image on a video. For some reason, I get the following error when I execute this command.

ffmpeg -i input.mp4 strict -2 -i overlay.jpg -filter_complex [0:v][1:v] overlay=25:25:enable='between(t,0,4)' output.mp4

Output file #0 does not contain any stream

Could anyone help me out? Thanks in advance!

like image 897
Daniel Christopher Avatar asked Apr 25 '16 06:04

Daniel Christopher


1 Answers

I was facing this same issue and my problem was: I was calling the execute method the wrong way. The string array I was passing was something like this:

final String[] cmd = new String[] { "-i input.mp4 strict -2 -i overlay.jpg -filter_complex [0:v][1:v] overlay=25:25:enable='between(t,0,4)' output.mp4" };

The correct way to create this array, though, is to split the command in separate strings:

final String[] cmd = new String[]{ "-i", "input.mp4", "strict", "-2", "-i", "overlay.jpg", 
                "-filter_complex", "[0:v][1:v]", "overlay=25:25:enable='between(t,0,4)'", "output.mp4"};

And then call execute:

try {
    final FFmpeg ffmpeg = FFmpeg.getInstance(context);
    ffmpeg.execute(cmd, new FFmpegExecuteResponseHandler() {
        @Override
        public void onSuccess(String message) {

        }

        @Override
        public void onProgress(String message) {

        }

        @Override
        public void onFailure(String message) {

        }

        @Override
        public void onStart() {

        }

        @Override
        public void onFinish() {

        }
    });
} catch (FFmpegCommandAlreadyRunningException e) {

}

I found this solution on a lauffenp's comment on this issue: https://github.com/WritingMinds/ffmpeg-android-java/issues/88

like image 113
Mateus Gondim Avatar answered Oct 01 '22 05:10

Mateus Gondim