rzeldent / esp32cam-rtsp

Simple RTSP (streaming image) server for the ESP32CAM. Easy configuration and monitoring through the web interface.
664 stars 121 forks source link

timestamp #70

Closed joopdo closed 1 year ago

joopdo commented 1 year ago

Sorry to raise a ticket for a simple question. Would I be able to project a timestamp on my camera feed with esp32cam-rtsp?

rzeldent commented 1 year ago

Hi Joop,

I think it is not possible to produce an overlay on an image using an esp32. It simply lacks the processing power. The RTSP frames do have a timestamp and, together with the start of the transmission, it should be possible to calculate the TS afterwards.

Will have to look if maybe it is possible to put a real timestamp on the stream (using NTP)....

Rene

On Fri, May 26, 2023 at 8:33 PM Joop @.***> wrote:

Sorry to raise a ticket for a simple question. Would I be able to project a timestamp on my camera feed with esp32cam-rtsp?

— Reply to this email directly, view it on GitHub https://github.com/rzeldent/esp32cam-rtsp/issues/70, or unsubscribe https://github.com/notifications/unsubscribe-auth/AB2ENBY2RT6OYARPBIJCNDTXIDZN7ANCNFSM6AAAAAAYQR6QGA . You are receiving this because you are subscribed to this thread.Message ID: @.***>

joopdo commented 1 year ago

Hi Rene,

I see, thank you for explaining!

Let me know if I can test or do something.

Have a good day

rzeldent commented 1 year ago

Hi Joop,

The timestamp that is given to each frame is taken from the function now(). See rtsp_server.cpp in the function: bool rtsp_server::client_handler(void *arg)

auto now = millis();
    for (const auto &client : self->clients_)
    {
        // Handle requests
        client->session->handleRequests(0);
        // Send the frame. For now return the uptime as time marker, currMs
        client->session->broadcastCurrentFrame(now);
    }

This is only an uint32 and as this is in milliseconds, an absolute time is not possible. In the streamer some more magic is going on:

  uint32_t units = 90000; // Hz per RFC 2435
    m_Timestamp += (units * deltams / 1000);                             // fixed timestamp increment for a frame rate of 25fps

It might be possible to change the timestamp here but this is in another library I do not own...

joopdo commented 1 year ago

Perfect! Just what I needed! Thank you sir!