title: How to capture / grab frames from the video stream?
body: <p>In my case, the video stream is from Android MediaRecorder. [Update] From some online information, the video stream normally can be fed in fd in the function setOutputFile(FileDescriptor fd). </p>
  
  <p>A post related to capture frames is here:
  "<a href="https://stackoverflow.com/questions/8839109/processing-android-video-frame-by-frame-while-recording?rq=1">Processing Android video frame by frame while recording</a>"</p>
  
  <p>One answer is: </p>
  
  <blockquote>
    <ol>
    <li>Open a stream using the NDK (possibly api, depending on implementations)</li>
    <li>Modify the bytes of the stream - each frame is sent as a separate packet. You have to grab each packet from the camera, and modify it.
    You can do a replace of colors, or you can translate. You can also use
    OpenGL to modify the image entirely by adding things like glass
    effects.</li>
    <li>...</li>
    </ol>
  </blockquote>
  
  <p>But I do not know what API/libraries can be used to capture/grab each frame from the video stream.
  (I have been able to encode frames to a video file using ffmpeg)</p>
  
  <p>I read "<a href="http://ffmpeg.org/trac/ffmpeg/wiki/Streaming%20media%20with%20ffserver" rel="nofollow noreferrer">wiki: Streaming media with ffserver</a>"</p>
  
  <p>But I am not clear about how to make programs in C/c++ to capture/grab frames from the video stream.</p>
  
  <p>Links with examples and tutorials would be appreciated.</p>