PTG-Kitware / angel_system

BSD 3-Clause "New" or "Revised" License
6 stars 15 forks source link

Ros bag creation from mp4: read framerate using cv2 to automate sampling strategy #426

Open cameron-a-johnson opened 1 month ago

cameron-a-johnson commented 1 month ago

Would it be desirable to default to an "auto" method that attempts to read the framerate and decide how to sample accordingly?

import cv2
cam = cv2.VideoCapture('video2.avi')
fps = cam.get(cv2.CAP_PROP_FPS)

Since we have 30Hz and 15Hz videos, and always want to sample at 15Hz... this might childproof the process a bit.

Purg commented 1 month ago

If its that simple sounds fine to me, but given my history with spotty metadata in these kinds of files we need to have an appropriate error-out or fallback logic when CAP_PROP_FPS may not be there.