v4l2, v4l2src and GstReferenceTimestampMeta

Nicolas Dufresne nicolas at ndufresne.ca
Thu Jan 28 18:24:43 UTC 2021


Le jeudi 28 janvier 2021 à 18:12 +0100, Philippe De Muyter a écrit :
> Hello all,
> 
> since gstreamer 1.14, there is a way to associate in a gstreamer pipeline
> reference timestamps to each frame.
> 
> As expressed by Sebastian (slomo),
> [https://marc.info/?l=gstreamer-cvs&m=149458219511878&w=2]
> 
>  buffer: Add GstReferenceTimestampMeta
>  
>  This is a meta that generically allows to attach additional reference
>  timestamps to a buffer, that don't have to relate to the pipeline clock
>  in any way.
>  
>  Examples of this could be an NTP timestamp when the media was captured,
>  a frame counter on the capture side or the (local) UNIX timestamp when
>  the media was captured.
>  
>  Examples of valid references would be "timestamp/x-drivername-stream"
>  for timestamps that are locally generated by some driver named "drivername"
>  when generating the stream, e.g. based on a frame counter, or
>  "timestamp/x-ntp, host=pool.ntp.org,port=123" for timestamps based on a
>  specific NTP server.
> 
> I would expect the v4l2src plugin to add such a timestamp to each frame
> using information coming from the v4l2 driver, especially if the driver
> provides UTC or TAI timestamps generated in the kernel.
> 
> How far are we from that goal ?

Far, the drivers only provide monotonic timestamp of the end of dma transfer.
The only other similar API is about time code, which relates to GstTimeCodeMeta,
but it's largely unimplement in the Linux kernel.

You could in theory make up some NTP numbers by translating from monotonic to
NTP, but that's no different then translating existing pipeline clock timestamp
imho. Overall, some patches and discussion need to go through the linux-media
mailing list before we can even considering doing something in mainline
GStreamer.

> 
> Best regards
> 
> Philippe De Muyter
> 




More information about the gstreamer-devel mailing list