|
@@ -707,8 +707,37 @@ ffmpeg -i "concat:1.ts|2.ts" -c copy output.mp4
|
|
|
* HTTP流转RTSP流
|
|
|
*/
|
|
|
public void streamConversion(String code) {
|
|
|
- log.info("ffmpeg -re -i /opt/streams/file/"+code+".mp4 -c:v copy -c:a copy -f rtsp rtsp://124.70.58.209:8554/live/"+code);
|
|
|
- cmdCameraUtil.cmd(ffmpegPath+" -re -i /opt/streams/file/"+code+".mp4 -c:v copy -c:a copy -f rtsp rtsp://124.70.58.209:8554/live/"+code);
|
|
|
+ log.info(ffmpegPath+" -re -i /opt/streams/file/"+code+".mp4 -c:v copy -c:a copy -f rtsp rtsp://124.70.58.209:8554/live/"+code);
|
|
|
+// cmdCameraUtil.cmd("find /opt/streams/record/flv/*/*/ -mmin +5 -name *.flv -exec rm -rf {} \\;");
|
|
|
+
|
|
|
+ try {
|
|
|
+ Process proc = Runtime.getRuntime().exec("/bin/bash", null, null);
|
|
|
+ BufferedReader in = new BufferedReader(new InputStreamReader(proc.getInputStream()));
|
|
|
+ PrintWriter out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(proc.getOutputStream())), true);
|
|
|
+ String commit = ffmpegPath+" -re -i /opt/streams/file/"+code+".mp4 -c:v copy -c:a copy -f rtsp rtsp://124.70.58.209:8554/live/"+code;
|
|
|
+ List<String> commands = new ArrayList<>();
|
|
|
+
|
|
|
+ // 删除
|
|
|
+ commands.add(commit);
|
|
|
+ log.info("HTTP流转RTSP流:{}", commands);
|
|
|
+ for (String line : commands) {
|
|
|
+ out.println(line);
|
|
|
+ }
|
|
|
+ String rspLine = "";
|
|
|
+ while ((rspLine = in.readLine()) != null) {
|
|
|
+ System.out.println(rspLine);
|
|
|
+
|
|
|
+ }
|
|
|
+ int i = proc.waitFor();
|
|
|
+ log.info("执行结果:{}", i);
|
|
|
+
|
|
|
+
|
|
|
+ } catch (IOException e) {
|
|
|
+ log.error(e.getMessage());
|
|
|
+ } catch (InterruptedException e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
|
|
|
|