|
@@ -45,6 +45,7 @@ import com.jcraft.jsch.JSchException;
|
|
import com.jcraft.jsch.Session;
|
|
import com.jcraft.jsch.Session;
|
|
import com.ozs.common.utils.HttpClientUtil;
|
|
import com.ozs.common.utils.HttpClientUtil;
|
|
import org.apache.commons.lang3.StringUtils;
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
|
+import org.bytedeco.javacv.FFmpegFrameGrabber;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
import org.springframework.context.annotation.Configuration;
|
|
import org.springframework.context.annotation.Configuration;
|
|
@@ -1397,4 +1398,19 @@ ffmpeg -i "concat:1.ts|2.ts" -c copy output.mp4
|
|
// 使用DateTimeFormatter解析日期
|
|
// 使用DateTimeFormatter解析日期
|
|
return LocalDate.parse(fullDateStr, DateTimeFormatter.ofPattern("MM dd yyyy"));
|
|
return LocalDate.parse(fullDateStr, DateTimeFormatter.ofPattern("MM dd yyyy"));
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ public void getDuration(String file) {
|
|
|
|
+ String filePath = "/opt/1.m4a";
|
|
|
|
+ try (FFmpegFrameGrabber grabber = new FFmpegFrameGrabber(filePath)) {
|
|
|
|
+ grabber.start();
|
|
|
|
+ // 总时长(纳秒)
|
|
|
|
+ long durationInNanoSeconds = grabber.getLengthInTime();
|
|
|
|
+ // 转换为秒
|
|
|
|
+ double durationInSeconds = durationInNanoSeconds / 1_000_000_000.0;
|
|
|
|
+ log.info("Audio Duration: " + durationInSeconds + " seconds");
|
|
|
|
+ grabber.stop();
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
+ e.getMessage();
|
|
|
|
+ }
|
|
|
|
+ }
|
|
}
|
|
}
|