logger.info("arg: {}", cmdList);
return cmdList;
}
- private static final Pattern PATTERN_TIME = Pattern.compile("time=(\\d+)");
+ private static final Pattern PATTERN_TIME = Pattern.compile("time=(\\d+):(\\d+):(\\d+)");
private int executeFfmpeg(final List<String> cmdList, int duration) throws InterruptedException, IOException {
Process process = null;
final Matcher m = PATTERN_TIME.matcher(msg);
double per = -1.0;
if (m.find()) {
- final String strTime = m.group(1);
- final double time = Double.parseDouble(strTime);
+ final double hour = Integer.parseInt(m.group(1));
+ final double min = Integer.parseInt(m.group(2));
+ final double sec = Integer.parseInt(m.group(3));
+ final double time = ((hour * 60) + min) * 60 + sec;
per = 100.0 * time / duration;
- logger.trace("time:{}, duration:{}", time, duration);
+ if (logger.isTraceEnabled()) {
+ logger.trace("time:{}, duration:{}", time, duration);
+ }
}
publish(new ConvertProgress(PROCESS, per, msg));
} else if (!msg.endsWith("No accelerated colorspace conversion found")) {