title: cvCaptureFromFile- Opening Video from specific path - Raspberry Pi
body: <p>I have OpenCV-2.4.9 installed in Raspberry Pi. Right now I am trying to load a video from specific path and for that I tried with both C and C++ API</p>
  
  <p>C API:  cvCaptureFromFile(path);</p>
  
  <p>C++ API: VideoCapture cap; cap.open(path)</p>
  
  <p>I am getting error and it says could not open file.</p>
  
  <p>It works well in Windows and Linux, but not in Raspberry Pi. Am I missing something?</p>
  
  <p>C++ code:</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;stdio.h&gt;
  #include &lt;stdlib.h&gt;
  #include &lt;string.h&gt;
  #include &lt;opencv2/opencv.hpp&gt;
  
  using namespace cv;
  using namespace std;
  
  int main(){
    VideoCapture cap("C:/Users/nava/Videos/file.mp4");
    if (!cap.isOpened()){
      cout &lt;&lt; "Error opening video stream" &lt;&lt; endl;
      return -1;
    }
  while (1){
      Mat Frame;
      if (!cap.read(Frame)){
          cout &lt;&lt; "No Frame available" &lt;&lt; endl;
          waitKey();
      }
      imshow("output", Frame);
      if (waitKey(33) == 27) break;
  }
  }
  </code></pre>
  
  <p>C Code:</p>
  
  <pre><code>#include "highgui.h"
  
  int main(int argc, char** argv)
  {
    cvNamedWindow("video",CV_WINDOW_AUTOSIZE);
    CvCapture* capture = cvCreateFileCapture("/home/pi/Desktop/test.mp4");
    IplImage* frame;
    while(1)
    {
     frame = cvQueryFrame(capture);
     if(!frame) break;
     cvShowImage("video", frame);
     char c = cvWaitKey(33);
     if(c == 27) break;
    }
    }
  </code></pre>