The OpenCV video interface does not expose many details about the video stream. It is intended to be a high-level interface for easy frame grabbing, it does not give access to low-level information of the codecs.
The frames returned by VideoCapture::read
are just images, they don't contain any information about the video (likea a frame number). You need to keep that information manually, separately.
If you start decoding at the beginning of the file, you can just use an integer counter for the successfully decoded frames that are returned from VideoCapture::read
.
Then there is VideoCapture::get
, with which you can access CV_CAP_PROP_POS_MSEC
, CV_CAP_PROP_POS_FRAMES
and CV_CAP_PROP_FPS
, which is as close you can get to PTS with the OpenCV interface.