Skip to content

[discussion] retrieve rtsp ntp time#672

Closed
ramoncaldeira wants to merge 2 commits into
PyAV-Org:developfrom
ramoncaldeira:rtcp-ntp-time
Closed

[discussion] retrieve rtsp ntp time#672
ramoncaldeira wants to merge 2 commits into
PyAV-Org:developfrom
ramoncaldeira:rtcp-ntp-time

Conversation

@ramoncaldeira
Copy link
Copy Markdown
Contributor

@ramoncaldeira ramoncaldeira commented May 26, 2020

Hi!

I have a use case where I would benefit from retrieving the camera's NTP time from a RTSP container. FFMPEG contains structures capable of parsing this information, but unfortunately they are internal and are not available in the public API.

I made this small patch to solve my problem. It is not generic enough, as it hardcodes ntp time into demux return. I also had to include vendor/ffmpeg-4.2 in include_dirs on setup.py.

My intention with this PR is to share the solution with you and hopely find out a way to change the code so that it can be incorporated into the project.

@ramoncaldeira
Copy link
Copy Markdown
Contributor Author

ramoncaldeira commented May 26, 2020

Run failed because of fatal error: libavformat/rtsp.h: No such file or directory.
This was expected, due to the private structures.

I tested the code myself with this snippet and it worked:

import av

input_ = av.open('RTSP_URL')

for (ntp, packet) in input_.demux(video=0):
    print('ntp', ntp)
    print('packet', packet)

@Hobeom
Copy link
Copy Markdown

Hobeom commented Jul 27, 2021

I used your branch to download the video stream with RTSP. The returned ntp value is as follows, how should I interpret it?

...
1627412725.1005974
1627412724.9732378
1627412725.1492114
...

@ramoncaldeira
Copy link
Copy Markdown
Contributor Author

@Hobeom It's time in seconds since epoch. You can use this converter: https://www.epochconverter.com/.

@samyhocine
Copy link
Copy Markdown

A very useful commit, unfortunately it fails completing the checking part :/

@jlaine
Copy link
Copy Markdown
Member

jlaine commented Mar 6, 2022

I'm sorry but I don't see this PR going anywhere, it completely changes the API.

@jlaine jlaine closed this Mar 6, 2022
@jimibit
Copy link
Copy Markdown

jimibit commented Apr 6, 2024

Hi!

I have a use case where I would benefit from retrieving the camera's NTP time from a RTSP container. FFMPEG contains structures capable of parsing this information, but unfortunately they are internal and are not available in the public API.

I made this small patch to solve my problem. It is not generic enough, as it hardcodes ntp time into demux return. I also had to include vendor/ffmpeg-4.2 in include_dirs on setup.py.

My intention with this PR is to share the solution with you and hopely find out a way to change the code so that it can be incorporated into the project.

Great !!
Very very useful.
Does this patch work in Windows ? Is it up-to-date ?

Jim

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants