‘liusuyi’
2023-08-29 dab37ef8c41decd4a26468ebd9fe77093051b996
ard-work/src/main/java/com/ruoyi/media/service/impl/MediaService.java
@@ -69,6 +69,11 @@
//            CmdUtils.commandStart(command);
            }
        }
        List<StreamInfo> paths = paths();
        for(StreamInfo path:paths)
        {
            mediaClient.removePath(path.getName());
        }
        List<Vtdu> vtduList = vtduMapper.selectVtduList(new Vtdu());
        for (Vtdu v : vtduList) {
            addPath(v.getName(), v.getRtspUrl(), v.getCodeType(), v.getIsCode());
@@ -103,7 +108,6 @@
        //String cmd = rootPath + "/lib/mediamtx/" +"ffmpeg -rtsp_transport tcp -i " + rtspPath + " -vcodec libx264 -preset:v ultrafast -r 25 -threads 4  -b:v 2048k -f rtsp rtsp://localhost:$RTSP_PORT/$MTX_PATH";
        //GPU硬解码编码 -hwaccel cuvid -c:v h264_cuvid  使用cuda解码   -c:v h264_nvenc 使用cuda编码
        //String cmd = rootPath  + "/lib/mediamtx/" + "ffmpeg -hwaccel cuvid -c:v h264_cuvid  -rtsp_transport udp  -i " + rtspPath + " -c:v h264_nvenc  -r 25 -threads 4  -b:v 2048k -bf 0 -f rtsp rtsp://localhost:$RTSP_PORT/$MTX_PATH";
        if (isCode.equals("1")) {
            String cmd = rootPath + "/lib/mediamtx/" + "ffmpeg -rtsp_transport tcp -i " + rtspPath + " -vcodec libx264 -preset:v ultrafast -r 25 -threads 4  -b:v 2048k -f rtsp rtsp://localhost:$RTSP_PORT/$MTX_PATH";
            if (!softwareDecoding) {
@@ -178,7 +182,7 @@
                info.setMode("1");
            } else {
                runoninit = item.getConf().getRunoninit();
                info.setMode("2");
                info.setMode("0");
            }
            //RTSP源地址
            String regex = "rtsp://[^\\s\"]+";