Browse Source

优化

master
blankk 2 years ago
parent
commit
e938cf385a
  1. 10
      ruoyi-code/src/main/java/com/ruoyi/code/camera/scheduled/RtspScreenshotTask.java

10
ruoyi-code/src/main/java/com/ruoyi/code/camera/scheduled/RtspScreenshotTask.java

@ -15,7 +15,6 @@ import org.springframework.stereotype.Component; @@ -15,7 +15,6 @@ import org.springframework.stereotype.Component;
import java.io.File;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
@ -30,10 +29,8 @@ public class RtspScreenshotTask { @@ -30,10 +29,8 @@ public class RtspScreenshotTask {
@Autowired
private ICameraBrandService iCameraBrandService;
@Scheduled(fixedRate = 1000000)
// @Scheduled(cron = "0 0/5 * * * ?")
@Scheduled(cron = "0 0/5 * * * ?")
public void rtspScreenshot(){
List<String> strList = new ArrayList<>();
String path = RuoYiConfig.getProfile() + File.separator;
String currentDate = new SimpleDateFormat("yyyy-MM-dd").format(new Date()) + File.separator;
String currentTime = new SimpleDateFormat("yyyy_MM_dd_HH_mm_ss").format(new Date()) + ".jpg";
@ -46,10 +43,7 @@ public class RtspScreenshotTask { @@ -46,10 +43,7 @@ public class RtspScreenshotTask {
file.mkdirs();
}
String ffmpeg = "ffmpeg -i \"rtsp://"+camera.getUsername()+":"+camera.getPassword()+"@"+camera.getIp()+cameraBrand.getRtsp()+"\" -y -f image2 -t 0.001 \""+fileName+currentTime+"\"";
strList.add(ffmpeg);
}
for (String s : strList) {
RuntimeUtil.execForStr(s);
RuntimeUtil.execForStr(ffmpeg);
}
}
}

Loading…
Cancel
Save