title: Unable to merge videos using FFMPEG Commands
body: <p>I am trying to merge two videos in Android using FFMPEG and I have been following the <a href="http://androidwarzone.blogspot.ae/2011/12/ffmpeg4android.html" rel="nofollow noreferrer">Android War Zone</a> blog which gives great ideas and simple methods to integrate FFMPEG in our project. However, I am facing issues in merging two videos. </p>
  
  <p><strong>Command :</strong></p>
  
  <pre><code>  vk.run(new String[]{
     "ffmpeg",
      "-f",
       "concat",
        "-i",
          list,
           "-s",
            "hd720",
              "-c",
                "copy",
                  "-b",
                   br_from_db + "k",
                     path + "/" + "merged_video_3.mp4"
                      }, work_path, getActivity());
  </code></pre>
  
  <p>And the "list" in the above command is the one where I am facing a issue.It throws me the following error when I use the following method :</p>
  
  <p><strong>Code :</strong></p>
  
  <pre><code>private String generateList(String[] inputs) {
          File list;
          Writer writer = null;
          try {
              list = File.createTempFile("ffmpeg-list", ".txt");
              writer = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(list)));
              for (String input : inputs) {
                  writer.write("file '" + input + "'\n");
                  Log.d(TAG, "Writing to list file: file '" + input + "'");
              }
          } catch (IOException e) {
              e.printStackTrace();
              return "/";
          } finally {
              try {
                  if (writer != null)
                      writer.close();
              } catch (IOException ex) {
                  ex.printStackTrace();
              }
          }
          Log.d(TAG, "Wrote list file to " + list.getAbsolutePath());
          return list.getAbsolutePath();
      }
  </code></pre>
  
  <p><strong>Error :</strong></p>
  
  <pre><code>12-16 19:49:57.416    5437-5437/? E/ffmpeg4android﹕ Command validation failed.
  12-16 19:49:57.416    5437-5437/? E/ffmpeg4android﹕ Check if input file exists: /data/data/com.family45.golive.family45v1/cache/ffmpeg-list-1803386407.txt/storage/emulated/0/DCIM/Camera/dec24.mp4 /storage/emulated/0/DCIM/Camera/vid2.mp4
  12-16 19:49:57.416    5437-5437/? W/System.err﹕ com.netcompss.ffmpeg4android.CommandValidationException
  12-16 19:49:57.416    5437-5437/? W/System.err﹕ at com.netcompss.loader.LoadJNI.run(LoadJNI.java:34)
  12-16 19:49:57.416    5437-5437/? W/System.err﹕ at com.netcompss.loader.LoadJNI.run(LoadJNI.java:49)
  </code></pre>
  
  <p>I obtained the command from <a href="https://stackoverflow.com/questions/20325615/android-concatenate-two-videos/20358243?noredirect=1#comment56374313_20358243">this</a> stack question. Its accepted but I am facing the above issue. I am very sure that the videos are present in their respective locations and all the paths are right but I cant seem to make it work.</p>
  
  <p>Any insights on this is highly appreciated. Thanks in advance. </p>
  
  <p><strong>Update :</strong></p>
  
  <p><strong>Call to generateList:</strong></p>
  
  <pre><code>ArrayList&lt;String&gt; paths_to_merge = new ArrayList&lt;String&gt;();
    paths_to_merge.add(path + "/" + "dec24.mp4");
    paths_to_merge.add(path + "/" + "vid2.mp4");
    LoadJNI vk = new LoadJNI();
    String[] v12 = new String[paths_to_merge.size()];
    v12 = paths_to_merge.toArray(v12);
    String list = generateList(v12);
  </code></pre>