简体   繁体   中英

Ffmpeg Command in Android not working. Creating a Video of several Images

I Try to load png's from my Folder and put it together in a single Video. I'm using Mobile-FFmpeg as Library and Android Studio

But I keep getting the ErrorCode after executing the Command:

I/mobile-ffmpeg: Command execution failed with rc=1 and the output below.

My Images are saved like this earlier

在此处输入图片说明

The Command i Use: int rc = FFmpeg.execute(" ffmpeg -r 1/5 -i "+ src+"/img%03d.png -c:v libx264 -vf \\"fps=25,format=yuv420p\\" "+ src + "/ou1t.mp4");

Here is the whole Code:

               String dirPath = Environment.getExternalStorageDirectory().getAbsolutePath()+"/FlyerMaker/ffmpeg";
            File dir = new File(dirPath);
            String src = Environment.getExternalStorageDirectory().getAbsolutePath()+"/FlyerMaker/ffmpeg";

            int rc = FFmpeg.execute(" ffmpeg -r 1/5 -i "+ src+"/img%03d.png -c:v libx264 -vf \"fps=25,format=yuv420p\" "+ src + "/ou1t.mp4");

            if (rc == RETURN_CODE_SUCCESS) {
                Log.i(Config.TAG, "Command execution completed successfully.");
            } else if (rc == RETURN_CODE_CANCEL) {
                Log.i(Config.TAG, "Command execution cancelled by user.");
            } else {
                Log.i(Config.TAG, String.format("Command execution failed with rc=%d and the output below.", rc));
                Config.printLastCommandOutput(Log.INFO);
            }

//clearing the Folder since I don't need the pics anymore right after the code above

            for(int i = 0; i < 20 ; i++){
                String filePrefix = "img"; //imagename prefix
                String fileExtn = ".png";//image extention
                String a = filePrefix + String.format("%03d", i)+fileExtn;
                File file = new File(dir, a);
                file.delete();
                System.out.println("del"+i);
            }

如果没有显示错误的日志,我最好的猜测是ffmpeg不应该包含在命令中:

int rc = FFmpeg.execute("-r 1/5 -i " + src + "/img%03d.png -c:v libx264 -vf \"fps=25,format=yuv420p\" "+ src + "/out.mp4");

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM