two pass encoding Cannot write log file 'ffmpeg2pass-0.log' for pass-1 encoding I'm trying to execute a two-pass encoding with compiled ffmpeg library in android.

I'm running my app on a device that is not rooted. So after executing below commands I get :


  Cannot write log file 'ffmpeg2pass-0.log' for pass-1 encoding:
  Read-only file system


List&lt;String&gt; testEncodeList = new LinkedList&lt;&gt;();
testEncodeList.add("-i");
testEncodeList.add(inputPath);
testEncodeList.add("-pass");
testEncodeList.add("1");
testEncodeList.add("-f");
testEncodeList.add("null");
testEncodeList.add("-");
// cmd.add("/dev/null");
runSingleFFmpegTask(this, testEncodeList, new ExecuteBinaryResponseHandler() {
    @Override
    public void onSuccess(String message) {
        super.onSuccess(message);
        SRLog.i("FFMPEG_PASS1:" + "onSuccess" + "\n" + message);


        List&lt;String&gt; cmd = new LinkedList&lt;&gt;();
        cmd.add("-i");
        cmd.add(inputPath);
        cmd.add("-pass");
        cmd.add("2");
        cmd.add(generateOutput(MP4_FORMAT));
        runSingleFFmpegTask(AudioComp.this, cmd, new ExecuteBinaryResponseHandler() {
            @Override
            public void onSuccess(String message) {
                super.onSuccess(message);
                SRLog.i("FFMPEG_PASS2:" + "onSuccess" + "\n" + message);
            }

            @Override
            public void onFailure(String message) {
                super.onFailure(message);
                SRLog.i("FFMPEG_PASS2:" + "onFailure" + "\n" + message);
            }
        });


    }

    @Override
    public void onFailure(String message) {
        super.onFailure(message);
        SRLog.i("FFMPEG_PASS1:" + "onFailure" + "\n" + message);
    }
});


Can I force log file 'ffmpeg2pass-0.log' be written in a custom path where a non-rooted device could access?
You have to set the -passlogfile option e.g. -passlogfile my/folder/path/fileprefix. ffmpeg will then write logs to files starting with fileprefix- in my/folder/path/. Set the option and same value in latter passes. The folder path must already exist.