减少ffmpeg执行时间,并检查命令中是否有错误

时间:2019-07-05 07:17:42

标签: android ffmpeg

我正在使用ffmpeg从图像创建视频,并且我的sd卡中有2个图像存储,但是当我运行代码时,执行时间太长,或者有时它只显示在执行中。我的问题是如何提高速度并检查我的命令中是否有任何问题

     String cmd[]={ "-r" ,"1/5", "-i", inputputimg, "-strict", 
  "experimental", "-vcodec" ,"libx264" ,"-preset" ,"ultrafast" ,"-crf" 
  ,"30",output};   

      String 
   inputputimg="/storage/emulated/0/FestiveApp/temp/img%02d.jpeg";



            public void ImageCommand(String command[])
{

    ffmpeg = FFmpeg.getInstance(MainActivity2.this);
    try {
        // to execute "ffmpeg -version" command you just need to pass "-version"
        ffmpeg.execute(command, new ExecuteBinaryResponseHandler() {

            @Override
            public void onStart() {
                Log.e("ffmpeg","Exaction Start");
            }

            @Override
            public void onProgress(String message) {

            }

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

            @Override
            public void onSuccess(String message) {
                imageprogressDialog.dismiss();
                Toast.makeText(MainActivity2.this,"success",Toast.LENGTH_SHORT).show();
            }

            @Override
            public void onFinish() {
                imageprogressDialog.dismiss();
                Log.e("ffmpeg","Exaction Start");
            }
        });
    } catch (FFmpegCommandAlreadyRunningException e) {
        imageprogressDialog.dismiss();
        Log.e("ffmpeg",e.toString());
    }
}

我希望视频需要花费几秒钟的时间进行编辑,并且我尝试合并到视频中,但它也需要同样的操作

0 个答案:

没有答案