Hi beepbeep:-), are you using openCV from ROS? In my case I had to enable "-D WITH_FFMPEG=ON" in pkg's Makefile and recompile. cheers,d. On Mon, Sep 13, 2010 at 11:24 PM, beepbeep wrote: > > Hello, > > I've been trying to get the following code working. It's a standard code to > read AVI files from here: > http://nashruddin.com/How_to_Play_AVI_Files_with_OpenCV > > Eventually, I want to send this to a camera display in Rviz. > > #include > #include "sensor_msgs/Image.h" > #include "image_transport/image_transport.h" > #include "cv_bridge/CvBridge.h" > #include > #include > > int main( int argc, char** argv ) > { >          IplImage  *frame; >          int key; >           //assert( argc == 2 ); >          CvCapture *capture = > cvCaptureFromAVI("/home/harish/Desktop/movie.avi"); >          printf("Hello1"); >          if( !capture ) >          { >          printf("Hello2"); >          return 1; >          } >          int fps = ( int )cvGetCaptureProperty( capture, CV_CAP_PROP_FPS ); >          cvNamedWindow( "video", 0 ); >          while( key != 'q' ) { >              frame = cvQueryFrame( capture ); >              if( !frame ) break; >              cvShowImage( "video", frame ); >              key = cvWaitKey( 1000 / fps ); >          } > >          cvReleaseCapture( &capture ); >          cvDestroyWindow( "video" ); >          return 0; >      } > > For some reason, cvCaptureFromAVI returns NULL, because Hello2 is printed in > the output. > The file movie.avi is stored in the bin folder, src folder, and package > folder as well. I've also tried an absolute path to my Desktop. > > The interesting thing is that the code executes perfectly if compiled using > g++ in the regular way, independent of ROS. But using rosmake, or just make, > something happens, and cvCaptureFromAVI returns NULL during execution. > > Any ideas? According to a friend, possibly something to do with rosmake or > the makefiles is creating trouble.. > > Thanks. > > > > > > > > -- > View this message in context: http://ros-users.122217.n3.nabble.com/cvCaptureFromAVI-returns-NULL-tp1468798p1468798.html > Sent from the ROS-Users mailing list archive at Nabble.com. > _______________________________________________ > ros-users mailing list > ros-users@code.ros.org > https://code.ros.org/mailman/listinfo/ros-users > -- MSc. Dejan Pangercic PhD Student/Researcher Intelligent Autonomous Systems Group Technische Universität München Telephone: +49 (89) 289-26908 E-Mail: dejan.pangercic@cs.tum.edu WWW: http://ias.cs.tum.edu/people/pangercic