|
@@ -24,7 +24,7 @@ public class VideoTool {
|
|
|
* @return
|
|
|
* @throws Exception
|
|
|
*/
|
|
|
- public static Long fetchAllPic(String ffmpegPath,String videoFilePath, String saveTmpDir,String targetDir, Date shootEndTime) throws Exception {
|
|
|
+ public static Long fetchAllPic(Long videoId, String ffmpegPath,String videoFilePath, String saveTmpDir,String targetDir, Date shootEndTime) throws Exception {
|
|
|
Long endTime = shootEndTime.getTime() ;
|
|
|
|
|
|
//ms
|
|
@@ -40,12 +40,12 @@ public class VideoTool {
|
|
|
Process proc = Runtime.getRuntime().exec(cmd);
|
|
|
proc.waitFor();
|
|
|
log.info("fetchAllPic end");
|
|
|
- moveFile(beginTime,saveTmpDir,targetDir,framRate);
|
|
|
+ moveFile(videoId,beginTime,saveTmpDir,targetDir,framRate);
|
|
|
|
|
|
return duration;
|
|
|
}
|
|
|
|
|
|
- private static void moveFile(Long beginTime,String saveTmpDir,String targetDir, int framRate){
|
|
|
+ private static void moveFile(Long videoId, Long beginTime,String saveTmpDir,String targetDir, int framRate){
|
|
|
log.info("moveFile start");
|
|
|
File saveTmpDirFile = new File(saveTmpDir);
|
|
|
File[] tmpFiles = FileUtil.sortByName(saveTmpDirFile.listFiles());
|
|
@@ -57,10 +57,10 @@ public class VideoTool {
|
|
|
String tmpFileName = tmpFile.getName();
|
|
|
String tmpFileExt = tmpFileName.substring(tmpFileName.lastIndexOf(".") + 1);
|
|
|
long time = beginTime + (i * (1000/framRate));
|
|
|
- String tmpFileNameNew = DateUtils.formatToDateStr(new Date(time),"yyyyMMddHHmmss") + "_" + UUID.randomUUID().toString() + "." + tmpFileExt;
|
|
|
- File tmpNewFile = new File(targetDir,tmpFileNameNew);
|
|
|
- log.info("tmpNewFile==" + tmpNewFile.getAbsolutePath());
|
|
|
- tmpFile.renameTo(tmpNewFile);
|
|
|
+ String targetFileNam = DateUtils.formatToDateStr(new Date(time),"yyyyMMddHHmmss") + "_" + UUID.randomUUID().toString() + "@" + videoId + "." + tmpFileExt;
|
|
|
+ File targetFile = new File(targetDir,targetFileNam);
|
|
|
+ log.info("tmpNewFile ==" + targetFile.getAbsolutePath());
|
|
|
+ tmpFile.renameTo(targetFile);
|
|
|
}
|
|
|
|
|
|
}
|