Skip to content

Extract timestamps in sync with RTSP sender's wall clock (start_time_realtime) #2365

Description

@jacob-aegis

I'd like to be able to capture timestamps from the sender's wall clock for RTSP. This helps for aligning any analytics drawn on a camera view. FFmpeg computes it from RTCP sender reports and stores it in the public AVFormatContext.start_time_realtime field (libavformat/rtsp.c). PyAV doesn't bind it as is though.

There looks to be a past PR that implemented this (#975), but it was closed due to the need for a public RTSP endpoint. I don't think network access is now needed to test this. The property returns None on any ordinary test file. The field itself comes from FFmpeg so the binding is what would need testing. Here is a code snippet with the suggested change:

av/container/input.py:
@property
def start_time_realtime(self):
    self._assert_open()
    if self.ptr.start_time_realtime != lib.AV_NOPTS_VALUE:
        return self.ptr.start_time_realtime

include/avformat.pxd:
int64_t start_time
int64_t start_time_realtime
av/container/input.pyi:
start_time_realtime: int | None

Would a PR along these lines be accepted? If there is another way to capture sender's timestamps as is, let me know.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions