title: Audio merge using FFMPEG Android
body: <p>I am trying to merge two audio files using ffmpeg with below command:  </p>
  
  <pre><code>String files = "-i " + voiceFile.getAbsolutePath() + " -i " + beatFile.getAbsolutePath();
  String filter = " -filter_complex [0:a]volume=0.99[a1];[1:a]volume=0.3[a2];[a1][a2]amerge=inputs=2,volume=1.3,pan=stereo|c0&lt;c0+c2|c1&lt;c1+c3[out]";
  String output = " -map [out] -strict -2 \"" + outputFile.getAbsolutePath();
  </code></pre>
  
  <p>But Im getting error </p>
  
  <blockquote>
    <p>"/sdcard/merged_audio.mp3: No such file or directory"</p>
  </blockquote>
  
  <hr>
  
  <p>Java code is</p>
  
  <pre><code>public void mergeAudio(File voiceFile, File beatFile) {
  
      File outputFile = new File(getMusicFilename());
      try {
          outputFile.createNewFile();
      } catch (IOException e) {
          e.printStackTrace();
      }
  
      String files = "-i " + voiceFile.getAbsolutePath() + " -i " + beatFile.getAbsolutePath();
      String filter = " -filter_complex [0:a]volume=0.99[a1];[1:a]volume=0.3[a2];[a1][a2]amerge=inputs=2,volume=1.3,pan=stereo|c0&lt;c0+c2|c1&lt;c1+c3[out]";
      String output = " -map [out] -strict -2 \"" + outputFile.getAbsolutePath();
      String cmd = files + filter + output;
      String[] command = cmd.split(" ");
      FFmpeg ffmpeg = FFmpeg.getInstance(getActivity());
      try {
  
          ffmpeg.execute(command, new ExecuteBinaryResponseHandler() {
  
              @Override
              public void onStart() {
              }
  
              @Override
              public void onProgress(String message) {
                  Log.v("onProgress", message);
              }
              @Override
              public void onFailure(String message) {
                  Log.v("onFailure", message);
              }
              @Override
              public void onSuccess(String message) {
                  Log.v("onSuccess", message);
              }
              @Override
              public void onFinish() {
                  Log.v("finsish", "finish");
  
              }
          });
      } catch (FFmpegCommandAlreadyRunningException e) {
          // Handle if FFmpeg is already running
      }
  }
  
  private String getMusicFilename() {
      fileUrl ="/sdcard/" + File.separator
              + "merged_audio.mp3";
      return fileUrl;
  }
  </code></pre>