From dab37ef8c41decd4a26468ebd9fe77093051b996 Mon Sep 17 00:00:00 2001
From: ‘liusuyi’ <1951119284@qq.com>
Date: 星期二, 29 八月 2023 17:12:29 +0800
Subject: [PATCH] 更新流媒体mediaMTX版本V1.0.0
---
ard-work/src/main/resources/templates/mediaMTX.html | 2
lib/mediamtx/mediamtx.exe | 0
ruoyi-admin/src/main/resources/META-INF/spring-configuration-metadata.json | 5 ++
lib/mediamtx/mediamtx.yml | 47 +++++++++++++++--------
ard-work/src/main/java/com/ruoyi/media/service/impl/MediaService.java | 8 +++-
5 files changed, 43 insertions(+), 19 deletions(-)
diff --git a/ard-work/src/main/java/com/ruoyi/media/service/impl/MediaService.java b/ard-work/src/main/java/com/ruoyi/media/service/impl/MediaService.java
index 9b69946..c9bc8b8 100644
--- a/ard-work/src/main/java/com/ruoyi/media/service/impl/MediaService.java
+++ b/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瑙g爜 -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\"]+";
diff --git a/ard-work/src/main/resources/templates/mediaMTX.html b/ard-work/src/main/resources/templates/mediaMTX.html
index b3a39ee..90c51b4 100644
--- a/ard-work/src/main/resources/templates/mediaMTX.html
+++ b/ard-work/src/main/resources/templates/mediaMTX.html
@@ -45,7 +45,7 @@
var chanMap = new Map();
window.onload = function () {
- chanMap.set("video1", "http://127.0.0.1:8889/164/");
+ chanMap.set("video1", "http://127.0.0.1:8889/245/");
chanMap.set("video2", "http://127.0.0.1:8889/164/");
chanMap.set("video3", "http://127.0.0.1:8889/164/");
chanMap.set("video4", "http://127.0.0.1:8889/165/");
diff --git a/lib/mediamtx/mediamtx.exe b/lib/mediamtx/mediamtx.exe
index 3e36228..69dc5b3 100644
--- a/lib/mediamtx/mediamtx.exe
+++ b/lib/mediamtx/mediamtx.exe
Binary files differ
diff --git a/lib/mediamtx/mediamtx.yml b/lib/mediamtx/mediamtx.yml
index c26403a..50ec5fa 100644
--- a/lib/mediamtx/mediamtx.yml
+++ b/lib/mediamtx/mediamtx.yml
@@ -64,8 +64,8 @@
###############################################
# RTSP parameters
-# Disable support for the RTSP protocol.
-rtspDisable: no
+# Enable support for the RTSP protocol.
+rtsp: yes
# List of enabled RTSP transport protocols.
# UDP is the most performant, but doesn't work when there's a NAT/firewall between
# server and clients, and doesn't support encryption.
@@ -104,8 +104,8 @@
###############################################
# RTMP parameters
-# Disable support for the RTMP protocol.
-rtmpDisable: no
+# Enable support for the RTMP protocol.
+rtmp: yes
# Address of the RTMP listener. This is needed only when encryption is "no" or "optional".
rtmpAddress: :1935
# Encrypt connections with TLS (RTMPS).
@@ -124,8 +124,8 @@
###############################################
# HLS parameters
-# Disable support for the HLS protocol.
-hlsDisable: yes
+# Enable support for the HLS protocol.
+hls: no
# Address of the HLS listener.
hlsAddress: :8888
# Enable TLS/HTTPS on the HLS server.
@@ -180,8 +180,8 @@
###############################################
# WebRTC parameters
-# Disable support for the WebRTC protocol.
-webrtcDisable: no
+# Enable support for the WebRTC protocol.
+webrtc: yes
# Address of the WebRTC listener.
webrtcAddress: :8889
# Enable TLS/HTTPS on the WebRTC server.
@@ -227,25 +227,36 @@
webrtcICETCPMuxAddress:
###############################################
+# SRT parameters
+
+# Enables support for the SRT protocol.
+srt: yes
+# Address of the SRT listener.
+srtAddress: :8890
+
+###############################################
# Path parameters
# These settings are path-dependent, and the map key is the name of the path.
-# It's possible to use regular expressions by using a tilde as prefix.
-# For example, "~^(test1|test2)$" will match both "test1" and "test2".
-# For example, "~^prefix" will match all paths that start with "prefix".
-# The settings under the path "all" are applied to all paths that do not match
+# It's possible to use regular expressions by using a tilde as prefix,
+# for example "~^(test1|test2)$" will match both "test1" and "test2",
+# for example "~^prefix" will match all paths that start with "prefix".
+# Settings under the path "all" are applied to all paths that do not match
# another entry.
paths:
all:
# Source of the stream. This can be:
- # * publisher -> the stream is published by a RTSP or RTMP client
+ # * publisher -> the stream is published by a RTSP, RTMP, WebRTC or SRT client
# * rtsp://existing-url -> the stream is pulled from another RTSP server / camera
# * rtsps://existing-url -> the stream is pulled from another RTSP server / camera with RTSPS
# * rtmp://existing-url -> the stream is pulled from another RTMP server / camera
# * rtmps://existing-url -> the stream is pulled from another RTMP server / camera with RTMPS
# * http://existing-url/stream.m3u8 -> the stream is pulled from another HLS server
# * https://existing-url/stream.m3u8 -> the stream is pulled from another HLS server with HTTPS
- # * udp://ip:port -> the stream is pulled from UDP, by listening on the specified IP and port
+ # * udp://ip:port -> the stream is pulled with UDP, by listening on the specified IP and port
+ # * srt://existing-url -> the stream is pulled from another SRT server
+ # * whep://existing-url -> the stream is pulled from another WebRTC server
+ # * wheps://existing-url -> the stream is pulled from another WebRTC server with HTTPS
# * redirect -> the stream is provided by another path or server
# * rpiCamera -> the stream is provided by a Raspberry Pi Camera
source: publisher
@@ -268,6 +279,8 @@
# If sourceOnDemand is "yes", the source will be closed when there are no
# readers connected and this amount of time has passed.
sourceOnDemandCloseAfter: 10s
+ # Maximum number of readers. Zero means no limit.
+ maxReaders: 0
###############################################
# Authentication path parameters
@@ -293,8 +306,8 @@
###############################################
# Publisher path parameters (when source is "publisher")
- # do not allow another client to disconnect the current publisher and publish in its place.
- disablePublisherOverride: no
+ # allow another client to disconnect the current publisher and publish in its place.
+ overridePublisher: yes
# if no one is publishing, redirect readers to this path.
# It can be can be a relative path (i.e. /otherstream) or an absolute RTSP URL.
fallback:
@@ -366,6 +379,8 @@
rpiCameraEV: 0
# Region of interest, in format x,y,width,height
rpiCameraROI:
+ # whether to enable HDR on Raspberry Camera 3.
+ rpiCameraHDR: false
# tuning file
rpiCameraTuningFile:
# sensor mode, in format [width]:[height]:[bit-depth]:[packing]
diff --git a/ruoyi-admin/src/main/resources/META-INF/spring-configuration-metadata.json b/ruoyi-admin/src/main/resources/META-INF/spring-configuration-metadata.json
index c074bd6..dc0f212 100644
--- a/ruoyi-admin/src/main/resources/META-INF/spring-configuration-metadata.json
+++ b/ruoyi-admin/src/main/resources/META-INF/spring-configuration-metadata.json
@@ -46,6 +46,11 @@
"description": "Description for mediamtx.host."
},
{
+ "name": "mediamtx.software_decoding",
+ "type": "java.lang.String",
+ "description": "Description for mediamtx.software_decoding."
+ },
+ {
"name": "mqtt.host",
"type": "java.lang.String",
"description": "Description for mqtt.host."
--
Gitblit v1.9.3