Synchronize archived videos
AnsweredHi,
I need to train my multi-camera tracking model with videos recorded by NX Witness.
This model requires for successive time points:
- a set of synchronized frames from each camera
- the related absolute timestamp
Of course, "synchronization" is approximate in this case (less than 100 ms, which is easily achieved with 20 FPS videos and negligible latency caused by the network and by NX Witness).
I thought about two methods for extracting such data from NX Witness:
1) using the /media/[camera uuid].mp4?pos=[start]&endPos=[end] endpoint
But I'm wondering whether I can reliably infer the frame timestamps from the PTS.
Also, I'm concerned with recording interruptions: for example, one minute could be missing in a camera, thus the video files would not be synchronized from the beginning to the end.
By the way, I know I can use accurate_seek but "this causes the stream to be transcoded" and I don't need a precise start timestamp: I only want synchronized frames, no matter when they start.
2) directly using the video chunks in .../HD Witness Media/hi_quality/uuid_[camera id]/[year]/[month]/[day]/[hour]/[start timestamp]_[duration].mkv
In this case, I'm wondering whether I can compute the frame timestamps by using the "start timestamp" / "duration" in the file name and interpolating with the PTS.
I'm concerned with video interruptions in this case as well.
In short, what's the best way to extract video files from NX Witness and reliably associate each frame with an absolute timestamp?
Thanks for reading.
-
Hello Mat,
I need to train my multi-camera tracking model with videos recorded by NX Witness.
Do you need these recorded videos specifically or any other videos may suit your needs?
What about using the in advanced prepared video clip with the testcamera?
BTW, we have already discussed this https://support.networkoptix.com/hc/en-us/community/posts/360052615193-testcamera-synchronize-multiple-streams
How did it do? -
Hi Mat L,
As of right now exporting video with /media/[camera uuid].mp4?pos=[start]&endPos=[end] provides you with an mp4 file with zero-value of FragmentAbsoluteTime mp4 metadata parameter.
Without an accurate_seek parameter passed you can never be sure what is the actual start time stamp of the video file. The download will start from the closest group of packets start which might be even a second before the requested value.
We plan to change that in near future. One of the patches to 4.2 version will likely contain this change as well as the upcoming version.
On the other hand, the second approach you mention should work as a charm.
No need to worry about video interruptions in this case.
Server has the embedded protection. If there's no data in the RTP stream for more than 10 seconds, new media file will be started.
If there's no data in the RTP stream for less than 10 seconds, there will be just a gap inside the mkv file but PTS counter won't stop. -
Andrey Terentyev, the post I previously opened (360052615193-testcamera-synchronize-multiple-streams) was really about testing the inference phase (synchronizing live frames and getting tracking results from a deep learning model - which I solved with your help, by the way).
This new post is about getting synchronized archived videos and training further my deep learning model.Sergey Yuldashev, about "one of the patches to 4.2 version...", you mean a non-zero FragmentAbsoluteTime?
-
Also, Sergey Yuldashev, "accurate_seek" works fine but is there a way of using it and getting the original resolution without re-encoding?
For now, I'm using /media/[camera uuid].mp4?pos=[start]&endPos=[end]&resolution=[original resolution]&accurate_seek but it results in much larger (x3) files (because of re-encoding, I guess). -
Hello Mat,
is there a way of using it and getting the original resolution without re-encoding?
Yes. You just omit the "resolution" parameter. In this case, the Server will send a stream with original resolution.
However, there is a peculiar aspect. For instance, when you have a "Low-res + motion" recording configured on a camera, the original resolution will change in time while the Server sends a stream.
Please sign in to leave a comment.
Comments
5 comments