Tx2 jetson_multimedia_api got capture timestamp?

I refer to jetson_multimedia_api demo(10_camera_recording ) to get video frame capture timestamp, code as follow:

stream = interface_cast<IBufferOutputStream>(pCamStream->outputStream.get());
if (!stream) {
    LOGERR(TAG, "capture task%d got stream failed, quit");
    return NULL;

        Buffer* buffer = stream->acquireBuffer();

        IBuffer* iBuff = interface_cast<IBuffer>(buffer);
        if (!iBuff) {
            LOGERR(TAG, "Failed to get IBuffer interface");

        const CaptureMetadata* metadata = iBuff->getMetadata();
        const ICaptureMetadata* iCaptureMetadata = interface_cast<const ICaptureMetadata>(metadata);
        if (!iCaptureMetadata) {
            LOGERR(TAG, "Failed to get ICaptureMetadata");

        pts = iCaptureMetadata->getSensorTimestamp();

I have some doubts about this timestamp:
1.Is the timestamp not the local time of the system, but the boot time of the system?
2.The pts is the time stamp used when capture interrupt processing?

Yes, it’s kernel time get by the kernel API.

Topic 1058122


Have a check this topic for the detail information.

Sorry, I mean api is do_gettimeofday or current_kernel_time ?
and I want to known where was the timestamp added, We test timestamps are not very uniform

It use clock_gettime() have a check the reference topic in early topic.

I saw a discussion about capture timestamps in the following post:

My issue is that I need to know exactly which APIis called in the driver to get the video timestamp, So I use the same interface to time stamp the IMU data

Have a check this link to know the detail.

Hi ShaneCCC,
For R32.4, the best way is to use clock_ gettime(MONOTONIC_ RAW) = cycle_ ns(TSC) - offset_ ns ??

Yes, it’s convert the time from RTCPU time to system kernel time.

The test was done according to the method mentioned above:
clock_gettime(CLOCK_MONOTONIC_RAW, &tp);
pts = iCaptureMetadata->getSensorTimestamp();
LOGDBG(TAG, “stream[%d] pts: %llu ns, offset_ns: %llu ns, clk_gtime: %llu ns”, pCamStream->streamId, pts, delta, (tp.tv_sec*1000000000 + tp.tv_nsec));

D/MultiCamera(11284): [app/src/camera/MultiCamera.cpp:112] stream[0] pts: 152252777000 ns, offset_ns: 9014495488 ns, clk_gtime: 152664531264 ns

It seems that the formula is wrong??

hello luopinjing,

according to Topic 78821, post #14.
please enable below to capture the start-of-frame timestamp of the sensor signaling,

while EGL stream capture the timestamp when it rendering the frame to display. it’s close to end-of-frame of the sensor signaling,

please also check this thread, Topic 159220,
it shows an example to calculate the HW capture timestamp (TSC) from system time.

We found that using libargus API to capture four channels 1920x1920@30fps video, the time stamp of the obtained video is jumping(normal interval should be about 33.33 milliseconds), have any advise??

hello luopinjing,

had you confirm with single stream, is this only happened with multi-channels?
if yes, this looks like a new issue, could you please initial another new thread for issue tracking.