title: FFMPEG how to mux MJPEG encoded data into mp4 or avi container c++
body: <p>I'm looking for a way to mux mjpeg (compressed) video data into a video container like mp4 or avi. (I'll also need to add audio in the future).
  Since i use FFMPEG in other parts of my project as well i'd like to do it using those libraries if possible.
  I'm not looking for command line FFMPEG use!
  I've tried to use the muxing example in ffmpeg with that i can only create a (very large) .mjpeg file with video information. This is not what I am looking for.</p>
  
  <p>Examples would be very welcome, but a pointer in the right direction also works!</p>
  
  <p>edit:
  I have output the yuvj422p stream to jpeg images and I want to put this into a mp4 container. Using ffmpeg commandline this works: </p>
  
  <p>ffmpeg -i yuvy%01d.jpg -vcodec mjpeg out.mp4 </p>
  
  <p>I would like to do this directely in my code (without creating jpeg images first ofcourse)</p>