Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to select a specific frame based on timestamp in openCV?

Tags:

python

opencv

I need to edit a specific frame in a video, but I only have the time in milliseconds in which I should make the edit. How to use this information to get the frame? A python example would be very appreciated!

like image 506
Mohamed Ali JAMAOUI Avatar asked Mar 20 '23 04:03

Mohamed Ali JAMAOUI


1 Answers

based on this link, the time related to a given frame can be found in the property CV_CAP_PROP_POS_MSEC where the doc is saying:

CV_CAP_PROP_POS_MSEC Current position of the video file in milliseconds or video capture timestamp.

Update: As mentioned by @Mouldri in the comments below, the value has been changed to CAP_PROP_POS_MSEC in openCV 3.

like image 64
Mohamed Ali JAMAOUI Avatar answered Mar 22 '23 22:03

Mohamed Ali JAMAOUI