I want add a progress bar during FFMPEG execution android.
When i start FFMPEG command then progress bar start with percentage progress.
I use it every where:
Pattern timePattern = Pattern.compile("(?<=time=)[\\d:.]*");
Scanner sc = new Scanner(message);
String match = sc.findWithinHorizon(timePattern, 0);
if (match != null) {
String[] matchSplit = match.split(":");
if (totalDur != 0) {
float progress = (Integer.parseInt(matchSplit[0]) * 3600 +
Integer.parseInt(matchSplit[1]) * 60 +
Float.parseFloat(matchSplit[2])) / totalDur;
int showProgress = (int) (progress * 100000);
progressDialog.setProgress(showProgress);
}
}
Use it at onProgress method.