My application detects objects and sends the detections to the cloud
For recording videos with detections, I also use a Smart Record mechanism:
In order to synchronise detection messages and video frames, I need to build an application.
In Smart_record, I don’t know what exactly the start time is (in milliseconds, not seconds).
For example: Smart_Record_1_00000_20241001-080218_1.mp4 not have milliseconds
Even if I know the exact first frame timestamp, how can I determine the next frames timestamps? Can I assume that the Smart record has a constant frame rate?
For each frame, I detect specific objects and save the detections (with the ntp_timestamp in my database).
For example, {ts:1730043469930115778 , rect:{x1:1,x2:1,y1:2,y2:2}}}
Additionally, I save the smart record video of the detections (starting when I detect the object for the first time)
In order to check the accuracy of the detection model, I have to be able to show my detection on each frame, so I take the video and try to find the correct ntp_timestamp for each frame.
Using the smart record video, it’s impossible for me to determine the exact timestamp for each frame
It is possible to save a video with filesink or something, but I have two streams to add with the REST API, and handling them will be complex.
I think the following method can work, I use nvurisrcbin as the soure element
1.Configurate the pipeline clock to ntp clock
from gi.repository import GLib, Gst, GstNet
pipeline = Gst.Pipeline()
# Create the NTP clock
clock = GstNet.NtpClock.new("ntp-clock", "time1.google.com", 123, 0)
# Set the pipeline to use the NTP clock
pipeline.use_clock(clock)