FPS in openCV vs FPS in VLC and Quicktime Player

asked 2015-07-10 10:22:40 -0600

Hello,

I am using openCV 2.4.11 for video analysing. I need a very precise framerate because I want to sync it with other data. When I use double fps = m_capture.get(CV_CAP_PROP_FPS); I get a framerate of 29.9167 FPS. But if I check the framerate in video players I get 28.45 FPS (Qucktime Player) and 28.447906 FPS (VLC). Windows shows 28 FPS. Which framerate is correct? Why does openCV get another framerate than the video players and windows which all seem to get the same just with different accuracies? I also consider using double pos = m_capture.get(CV_CAP_PROP_POS_MSEC);. Is this reliable?

I would be glad if someone helped me with this issue.

edit retag flag offensive close merge delete

Comments

1

"I need a very precise framerate" - what are you trying to achieve ?

VideoCapture is just a utility for quick and easy image access, don't expect too much from it.

also, the "grab a frame, process it, sleep some millis" loop approach there won't ever be as exact timewise, as you seem to want it.

berak gravatar imageberak ( 2015-07-10 10:36:51 -0600 )edit

I want to merge sensor data from an Android device with recorded video data. I record the sensor values with timestamps and I have one point at the beginning where I can sync them with the video stream. If I have an exact framerate I can calculate the time that passes every frame. I'm just bewildered because I suggested a high precision with so many internal decimal places (29.9167), but I think the framerate is wrong.

phil_777 gravatar imagephil_777 ( 2015-07-13 02:48:37 -0600 )edit

no idea, how vlc or quicktime measure fps, but you'll probably have to give up on the idea, that time between frames will be constant, this will never happen.

imho, you'll have to take timestamps for the image frames as well, and either interpolate your sensor data or the images accordingly.

berak gravatar imageberak ( 2015-07-13 03:04:15 -0600 )edit

I'm now using double pos = m_capture.get(CV_CAP_PROP_POS_MSEC); and it is accurate enough for testing. Later I will do everything in real-time with streamed video and sensor data, so I won't have this problem any more.

phil_777 gravatar imagephil_777 ( 2015-07-13 09:25:32 -0600 )edit