Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Is it possible to get frame timestamps for live streaming video frames on linux?

I'm using OpenCV version 2.3 with a usb camera, Logitech C920, on linux (ubuntu).

I'm able to open the video stream, however, the call: CV_CAP_PROP_POS_MSEC (current position in milliseconds) does not work.

I've used other wrappers on V4L and similar calls have worked (e.g via V4L4J).

Can someone clarify:

  • --> Is there indeed no way to use openCV's video API with a usb camera and get timestamps on each frame?

    • Workarounds I can imagine: a flag to build OpenCV with; a newer version of the OpenCV API; some configuration call on the lower level v4l drivers, etc.

I'm trying to work out latency in a processing pipeline, and coordinate cameras across machines, and without timestamps it's a real challenge.

I see numerous informal answers to questions suggesting OpenCV doesn't offer timestamps on live-streaming video, but nothing is definitive.

At the same time, there are hints that there are ways to do this, for example:

  • on code.opencv.org, (last updated 2 yrs ago) there was a patch submitted that would appear to address this: http://code.opencv.org/issues/722 ?

  • we see the struct CvCaptureCAM_V4L has a 'struct timeval timestamp' (this is version 2.4.11 of OpenCV, e.g - https://fossies.org/dox/opencv-2.4.11/cap__v4l_8cpp_source.html )

So, can anyone clarify, how to get the frame's timestamp, or that it cannot be done?

Thank you!!