delay on video

asked 2014-06-23 10:12:06 -0600

Clem50FFF gravatar image

hi everybody, i just tried to use the new version of openCV 2.4.9 with visual studio with both version x64 and x86 and it result that video is delayed (about 250ms - 500ms late) the problem is i don't have the problem with the version 2.2 win 32 of opencv(the video is in realtime without delayed). i wanted to try with other version (2.4.8; 2.4.7;2.4.6) and i get the same result that the 2.4.9 version. here below the computer features: proc: Intel(R) Core(TM) i7-3970X CPU Ram : 16gb SO: 64bit

do you have any idea why i have this kind of result with lastest version of opencv?

edit retag flag offensive close merge delete

Comments

1

Share your approach or code please! Probablyy you are still using old API commands...

StevenPuttemans gravatar imageStevenPuttemans ( 2014-06-23 12:57:37 -0600 )edit

here the code :

frame = cvQueryFrame( capture );

if ( !original ) { original = cvCreateImage( cvGetSize( frame ), IPL_DEPTH_8U, 3 ); cvGetSize( frame ); original->origin = frame->origin; } cvCopy( frame, original ); //cvNamedWindow( "",CV_WINDOW_NORMAL && CV_GUI_NORMAL); //cvMoveWindow("",Position_x,Position_y); //cvResizeWindow("",640,480); //cvShowImage( "", original );

but i think that the problem comes from codec because i get some errors when the video is running.

Someone know how workthe codec in Opencv?

Clem50FFF gravatar imageClem50FFF ( 2014-06-24 09:18:29 -0600 )edit

Just like I thought. Please stop using the old C-API. It is depricated, has known problems and will be dropped rather soon in future releases. The new C++ API is far more stable and better develloped.

StevenPuttemans gravatar imageStevenPuttemans ( 2014-06-25 04:53:32 -0600 )edit

Hi Steven,

So I change my code with that one, can you tell me if it's the good API :

include "opencv2/opencv.hpp"

using namespace cv;

int main() { VideoCapture cap("rtsp://192.168.###.###:554/ch2");

if(!cap.isOpened())  

    return -1;

namedWindow("Video",1);

for(;;)

{

    Mat frame;

    cap >> frame; 

    imshow("Video", frame);

    if(waitKey(30) >= 0) break;

}

return 0;

}

Clem50FFF gravatar imageClem50FFF ( 2014-06-26 03:26:24 -0600 )edit