title: Create a video from OpenGL rendered frames
body: <p>I am trying to create a video file from an animation I have in OpenGL.
  I have been reading on how to do that and to my understanding there are two options:</p>
  
  <ol>
  <li>Save each rendered frame in OpenGL to an image file and then create a video file from those</li>
  <li>Get the frame data using <code>glReadPixels()</code> and on the fly write those to a video file</li>
  </ol>
  
  <p>The second approach is what I believe would work best for me, however, I cannot find info on how to achieve the second part (write to a video file).</p>
  
  <p>Can anyone point me out to some web sites where I learn how to do that? What kind of libraries are out there that I can use to encode(?) a video from the frames I am rendering in OpenGL?</p>
  
  <p><strong>EDIT</strong></p>
  
  <p>After searching a bit more about this, I believe ffmpeg is the way to go. I found <a href="http://blog.mmacklin.com/2013/06/11/real-time-video-capture-with-ffmpeg/" rel="nofollow">this blog</a> that has a code that apparently works on windows.</p>
  
  <p>I have downloaded ffmpeg from the website so that I can execute the command just as in the example. Unfortunately, my application crashes and no video is being created. I checked for the file pointer to be valid but it is not, so I believe the error comes from the execution of the function <code>popen</code>.</p>
  
  <p>I am passing the exact same arguments as the command but still no valid file pointer, any idea on what could be happening?</p>
  
  <p>The thing is, I don't want to spend much time coding the video encoding since I have other projects to work on.</p>