Add Audio To Video using ffmpeg

 List<String> cmdList = new ArrayList<>();

cmdList.clear();

cmdList.add("-i");

cmdList.add(videoPath);

cmdList.add("-i");

cmdList.add(audioPath);

cmdList.add("-c:v");

cmdList.add("copy");

cmdList.add("-map");

cmdList.add("1:a:0");

cmdList.add("-map");

cmdList.add("0:v:0");

cmdList.add(outputPath);


int returnCode = com.arthenica.mobileffmpeg.FFmpeg.execute(cmdList.toArray(new String[cmdList.size()]));

if (returnCode == RETURN_CODE_SUCCESS) {

   //  Completed with success
} else if (returnCode == RETURN_CODE_CANCEL) {

} else {

}

Comments