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.
@@ -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
- const archiveRtspUrl = `rtsp://${node.user}:${node.pass}@${node.host}:554/Streaming/tracks/${trackId}/?starttime=${rtspTimestamp}`;
134
- node.warn(`[DEBUG RTSP] Chiamata finale: ${archiveRtspUrl}`);
135
-
136
- // Via il flag -rtsp_transport tcp per sbloccare il timeout UDP
137
- const ffmpegRtspCmd = `ffmpeg -y -i "${archiveRtspUrl}" -t 15 -c:v copy -c:a aac -movflags +faststart "${fixedPath}"`;
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) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "node-red-contrib-hik-media-buffer",
3
- "version": "1.1.105",
3
+ "version": "1.1.106",
4
4
  "description": "Ottiene buffer video e immagine da camere Hikvision via ISAPI",
5
5
  "keywords": [
6
6
  "node-red",