node-red-contrib-hik-media-buffer 1.1.105 → 1.1.106
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/hik-media-buffer.js +8 -5
- package/package.json +1 -1
package/hik-media-buffer.js
CHANGED
|
@@ -130,11 +130,14 @@ module.exports = function(RED) {
|
|
|
130
130
|
const fixedPath = path.join(baseStorage, `hik_v_${channelID}_${timestamp}.mp4`);
|
|
131
131
|
const fullImgPath = path.join(baseStorage, `img_${timestamp}.jpg`);
|
|
132
132
|
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
133
|
+
// Cambiamo leggermente l'endpoint usando /channels/ che è più tollerante sul TCP d'archivio
|
|
134
|
+
const archiveRtspUrl = `rtsp://${node.user}:${node.pass}@${node.host}:554/Streaming/channels/${channelID}01/?starttime=${rtspTimestamp}`;
|
|
135
|
+
node.warn(`[DEBUG RTSP] Tentativo TCP blindato su: ${archiveRtspUrl}`);
|
|
136
|
+
|
|
137
|
+
// -rtsp_transport tcp forza il tunnel stabile senza pacchetti persi
|
|
138
|
+
// -stimeout imposta il timeout interno della connessione a 20 secondi (in microsecondi)
|
|
139
|
+
// -fflags +genpts forza FFmpeg a ricostruire i timestamp mancanti ignorando i drop iniziali dell'NVR
|
|
140
|
+
const ffmpegRtspCmd = `ffmpeg -y -rtsp_transport tcp -stimeout 20000000 -i "${archiveRtspUrl}" -t 15 -fflags +genpts -c:v copy -c:a aac -movflags +faststart "${fixedPath}"`;
|
|
138
141
|
|
|
139
142
|
await new Promise((resolve) => {
|
|
140
143
|
exec(ffmpegRtspCmd, { timeout: 25000 }, (err) => {
|