I'm using https://github.com/hiteshsondhi88/ffmpeg-android-java in an app that needs to combine multiple mp4 files into one.
Here is a command
ffmpeg -i concat:"/data/data/com.testapp.app/cache:temp/lds82df9skov65i15k3ct16cik.mp4|/data/data/com.testapp.app/cache:temp/qm5s0utmb8c1gbhch6us2tnilo.mp4" -codec copy /data/data/com.testapp.app/cache:temp/4egqalludvs03tnfleu5dgb6iv.mp4
java method to append files, movie files is an array holding files i want to combine
public void appendFiles() {
showProgressDialog();
movieFile = getRandomFile();
StringBuilder b = new StringBuilder();
try {
for (int i = 0; i < movieFiles.size(); i++) {
File f = movieFiles.get(i);
if (!f.exists()) {
continue;
}
if(i != 0){
b.append("|");
}
b.append(f.getPath());
}
final String command = "-i concat:\""+b.toString() + "\" -codec copy " + movieFile.getPath();
try {
ffmpeg.execute(command, new ExecuteBinaryResponseHandler() {
@Override
public void onFailure(String s) {
app.log("FAILED with output : " + s);
}
@Override
public void onSuccess(String s) {
app.log("SUCCESS with output : " + s);
createThumbnail();
stopProgressDialog();
startReview();
}
@Override
public void onProgress(String s) {
app.log("Started command : ffmpeg " + command);
}
@Override
public void onStart() {
app.log("Started command : ffmpeg " + command);
}
@Override
public void onFinish() {
app.log("Finished command : ffmpeg " + command);
}
});
}
catch (FFmpegCommandAlreadyRunningException e) {
e.printStackTrace();
}
}
catch (Exception e) {
e.printStackTrace();
}
}
and getRandomFile()
public File getRandomFile() {
if (captureDir != null) {
if (captureDir.exists()) {
SecureRandom random = new SecureRandom();
File file = new File(captureDir, new BigInteger(130, random).toString(32) + ".mp4");
return file;
}
}
return null;
}
but I keep seeing the error no such file or directory
concat:"/data/data/com.testapp.app/cache:temp/lds82df9skov65i15k3ct16cik.mp4|/data/data/com.testapp.app/cache:temp/qm5s0utmb8c1gbhch6us2tnilo.mp4": No such file or directory
any ideas?