use of org.apache.commons.exec.DefaultExecuteResultHandler in project ddf by codice.
the class VideoThumbnailPlugin method getVideoDuration.
private Duration getVideoDuration(final String videoFilePath) throws IOException, InterruptedException {
final ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
final PumpStreamHandler streamHandler = new PumpStreamHandler(outputStream);
final CommandLine command = getFFmpegInfoCommand(videoFilePath);
final DefaultExecuteResultHandler resultHandler = executeFFmpeg(command, 15, streamHandler);
resultHandler.waitFor();
return parseVideoDuration(outputStream.toString(StandardCharsets.UTF_8.name()));
}
Aggregations