Obtain RTSP stream for recent timestamps
CompletedHi,
Context: I developed an NX plugin to send frames to external software that does multi-object tracking and then stores the results into a database. The end user watches the video stream and the tracking results in the browser (NX Witness => RTSP => (video remapping) => WebRTC => browser).
The end-to-end tracking process requires a few seconds. To make sure the tracking results are available (end-to-end processing = several seconds) along the video, I use this:
rtsp://nxmediaserver:7001/camera-uuid?onvif_replay=1&pos=[NOW MINUS PROCESSING DELAY]
The processing delay is not fixed. I compute it before I call the RTSP endpoint.
When PROCESSING DELAY is less than 60 seconds, I often get this error (the following error output is from ffplay):
[rtsp] method DESCRIBE failed: 503 Service Unavailable
Server returned 5XX Server Error reply
60 seconds is not a precise value. The smaller the value is, the higher the probability of the error is.
I used this command to test some values:
ffplay -i "rtsp://nxmediaserver:7001/camera-uuid?onvif_replay=1&pos=$(date -d '-15 sec' +%s%N | cut -b1-13)"
How can I get the RTSP stream for recent timestamps?
-
Hello Mat,
[rtsp] method DESCRIBE failed: 503 Service Unavailable
Server returned 5XX Server Error replythis error occurs when you request timestamp which hasn't been written to archive yet. For better storage optimisation, NX server buffers chunks of video frames in memory and writes whole 60 seconds of data to the disk as single write operation. Because of that, it isn't possible to access archive footage with timestamps like $(date -d '-15 sec' +%s%N | cut -b1-13)" . You can decrease 60 seconds to lower values, but this would increase the load on your storage.
On windows – go to the registry
Computer\HKEY_LOCAL_MACHINE\SOFTWARE\Network Optix\Network Optix Media Serversand add stringmediaFileDurationfor which you can specify the file length in seconds.
On Linux – settings are stored inmediaserver.conffile located at/opt/networkoptix/mediaserver/etc/mediaserver.confThe default value is 60
Please note, that you should stop mediaserver process before modifying this value.
1 -
Thanks Anton Babinov for answering.
I would have to decrease this value to ~5 seconds and I guess it would cause a serious performance penalty.
Is it possible to configure the NX media server to delay the live stream by a few seconds or is it something I can only achieve by using a buffer in the client? (I think NX Desktop does this with a 500 ms buffer)0 -
Hi, Mat L
thanks for the feedback!
We know this issue with not being able to stream last minute is a bummer. But we did some improvements in 4.3 and you can check it out in our early developer preview -- Nx Meta: https://meta.nxvms.com/downloads/patches (take the latest 4.3 one)
The server now is able to send the archive from its buffer, up to ~ LIVE - 3sec. But coming closer to the Live "end of the stream" might be returned in rtsp when a client asks more than it is available till Live. Can you experiment with it and tell us how it works and if it suits your scenarios?0 -
Thanks Tagir Gadelshin. I will try this update and tell you if it fits our needs.
0
Please sign in to leave a comment.
Comments
4 comments