Nvarguscamerasrc gstreamer timestamps bad values, buffer has no offset or duration

I am using Gstreamer to record four IMX390 Leopard Imaging cameras at the same time with Python. I want to see if the cameras are streaming in synch, so I access the buffer timestamps (pts and dts), offset and duration and save them all to file.

By recording an external screen showing a timer, I can see that the four cameras seem to be in sync and capturing at 30 fps as they should.

The problem I have is that for each camera the timestamps saved to file seem to not be regular at all, in contrast to what their frames are showing. I am capturing at 30fps, so I am expecting the difference between consecutive timestamps to be around 33ms, but what I see instead varies between 10ms to 50ms. Moreover the two timestamps pts and dts are the same, and the offset and duration have no valid value.

Here is my input pipeline

def gstreamer_in(cam_id):
    """ Creates string with gstreamer input pipeline """
    gst_in =  ('nvarguscamerasrc sensor-id={} ! ' 
    'video/x-raw(memory:NVMM), height=1080, width=1920, framerate=(fraction)30/1, format=NV12 ! ' 
    'nvvidconv ! video/x-raw, height=1080, width=1920, format=BGRx ! '
    'videoconvert ! video/x-raw, format=BGR ! '
    'appsink emit-signals=true sync=false').format(cam_id)
    return gst_in

and here are a few of the values that I am getting

N frame,dts,pts,offset,duration
0,0:00:03.527208860,0:00:03.527208860,CLOCK_TIME_NONE,CLOCK_TIME_NONE
1,0:00:03.606427245,0:00:03.606427245,CLOCK_TIME_NONE,CLOCK_TIME_NONE
2,0:00:03.643383157,0:00:03.643383157,CLOCK_TIME_NONE,CLOCK_TIME_NONE
3,0:00:03.682110536,0:00:03.682110536,CLOCK_TIME_NONE,CLOCK_TIME_NONE
4,0:00:03.730528664,0:00:03.730528664,CLOCK_TIME_NONE,CLOCK_TIME_NONE
5,0:00:03.771878491,0:00:03.771878491,CLOCK_TIME_NONE,CLOCK_TIME_NONE

Even if frames look ok, I still need precise timestamps to be able to synchronize these captures with other events.
I tried to print the timestamps directly by command line and the results are the same, so I assume Python is not the problem here.

Would this be an issue in nvarguscamerasrc or the camera themselves?
I am a beginner in Gstreamer, any help about understanding what’s going on would be greatly appreciated.

How do you get the timestamp from this pipeline?
I would suggest to use Argus API to get the timestamp.

https://docs.nvidia.com/jetson/l4t-multimedia/classArgus_1_1ICaptureMetadata.html#ae4ff79489b0aef6766742a61d1a17cfc

Thank you @ShaneCCC. I am accessing the timestamps in Python through the GstBuffer.
When I printed them from command line instead I used fakesink silent=false 2>&1 > ts.txt at the end of the pipeline and extracted the values from there.
Is it possible to access getSensorTimestamp() when calling gstreamer from the command line or in Python?

Can’t access getSensorTimestamp() from the gst pipeline, but the nvarguscamerasrc was source public for customize, you can try this way.

Ok, thank you I will try that

Actually @ShaneCCC , would you happen to have an example that shows how to use the Argus API features that are not the default ones?

You can reference to the argus_camera sample code.