Get frame number or manifest time stamp of live stream HLS/m3u8

asked 2019-01-30 05:14:54 -0500

tai gravatar image

I am using VideoCapture to read frames from a HLS live stream and processing the frames asynchronously so i need a method to keep the frames and the returned data in sync.

Is it possible to get the timestamp or frame number or EXT-X-MEDIA-SEQUENCE or .ts filename or some kind of identifying number relative to the live stream's frame?

cap.get(cv2.CAP_PROP_POS_FRAMES) and cap.get(cv2.CAP_PROP_POS_MSEC) get the frame number and timestamp relative to when videocapture starts reading from the stream. (eg: if videocapture started when the stream was on frame 5000, when live stream is on frame 5010, frame number would return only 10). This becomes a bigger problem if my videocapture function breaks then i lose all sense of order with the frames.

is there anything in opencv that would allow me to get some form of identification for a frame relative to the stream or would I, for example, have to use ffmpeg which could have a method to get that data and get the frames using that instead then process with opencv?

Id prefer to use python but c++ could be an option for the frame reading if needed

edit retag flag offensive close merge delete


Did you get an answer / solution on this? i'm running through the same problem and not sure what to do about it..

ipipinstall gravatar imageipipinstall ( 2020-09-15 01:51:08 -0500 )edit