[英]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.我尝试从我的文件夹中加载 png 并将其放在一个视频中。 I'm using Mobile-FFmpeg as Library and Android Studio
我使用 Mobile-FFmpeg 作为库和 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. I/mobile-ffmpeg:命令执行失败,rc=1 和以下输出。
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");我使用的命令: 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");
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.