diff --git a/pom.xml b/pom.xml
index b298f22..8a34a1a 100644
--- a/pom.xml
+++ b/pom.xml
@@ -52,6 +52,9 @@
2.0.53
+
+
+
diff --git a/src/main/java/com/tuoheng/steam/dos/StreamTask.java b/src/main/java/com/tuoheng/steam/dos/StreamTask.java
index b3410da..f964ff9 100644
--- a/src/main/java/com/tuoheng/steam/dos/StreamTask.java
+++ b/src/main/java/com/tuoheng/steam/dos/StreamTask.java
@@ -12,6 +12,16 @@ public class StreamTask implements Serializable {
Long taskId;
Date startTime;
String strStartTime;
+
+ public String getDuration() {
+ return duration;
+ }
+
+ public void setDuration(String duration) {
+ this.duration = duration;
+ }
+
+ String duration;
/**
* 接收到结束命令的时间
*/
diff --git a/src/main/java/com/tuoheng/steam/service/TaskService.java b/src/main/java/com/tuoheng/steam/service/TaskService.java
index 5b8ec56..0fb5a64 100644
--- a/src/main/java/com/tuoheng/steam/service/TaskService.java
+++ b/src/main/java/com/tuoheng/steam/service/TaskService.java
@@ -16,8 +16,10 @@ import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import javax.annotation.PostConstruct;
+import java.io.BufferedReader;
import java.io.File;
import java.io.IOException;
+import java.io.InputStreamReader;
import java.util.*;
import java.util.concurrent.*;
@@ -198,6 +200,31 @@ public class TaskService implements ITaskService{
historyTasks.get(streamUrl).offerLast(currentStreamTask);
}
+ if(Objects.nonNull(currentStreamTask.getMergeProcess())){
+ if(Objects.nonNull(currentStreamTask.getMergeProcess().getFileName()) &&
+ !currentStreamTask.getMergeProcess().getFileName().isEmpty()){
+ try {
+ Process process = Runtime.getRuntime().exec("/data/ffmpeg/bin/ffmpeg -i " +
+ currentStreamTask.getMergeProcess().getFileName());
+ BufferedReader reader = new BufferedReader(new InputStreamReader(process.getErrorStream()));
+ String line;
+ while ((line = reader.readLine()) != null) {
+ if (line.contains("Duration")) {
+ System.out.println("line: " + line);
+ String duration = line.split("Duration: ")[1].split(",")[0];
+ System.out.println("Duration: " + duration.substring(0, 8));
+ currentStreamTask.setDuration(duration.substring(0, 8));
+ break;
+ }
+ }
+ reader.close();
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+
+ }
+
return currentStreamTask;
} catch (Exception e) {
logger.info("taskId {} Stop exceptionally", streamUrl,e);
diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties
index bacaf35..df25245 100644
--- a/src/main/resources/application.properties
+++ b/src/main/resources/application.properties
@@ -1,5 +1,5 @@
spring.application.name=demo
-server.port = 9011
+server.port = 8989
srs.splitPath=/data/java/srs/stream_server/temp
srs.targetPath=/data/java/srs/srs/trunk/objs/nginx/html
#srs.splitPath=/Users/sunpeng/workspace/stream/temp