title: How to read .avi files C++
body: <p>I want to read in an .avi video file for a program that I am making. I have the file location saved as a <code>string</code>. Is there any good tutorials on using .avi files in c++ or does anyone know who to read one in? Is it the same as normal files?</p>
  
  <p>I have a <a href="https://stackoverflow.com/questions/5821707/cropping-a-video-file-with-defined-width-length-and-pixel-location">previously asked SO question</a> that goes into better detail but here is what I want to do:</p>
  
  <p>I am making a program that will detect faces (though OpenCV) As of now I have been given a video processor program that will detect each face on a frame, and return the frame as a image and the <code>CvRec</code> of the faces. I want to take these faces and test them to validate that they are all actually faces.</p>
  
  <p>After I have all the faces (tested) I want to then take the images and test them together. I test the faces on each frame for size and distance changes. If the faces pass this for a frame length of two seconds, then I want to crop the face and make it the subject of each frame.</p>
  
  <p>After each frame is cropped I then want to save the new video file for the user.</p>
  
  <p>Hopefully that helps. If anyone needs a better explanation please let me know.</p>