title: Converting raw data to displayable video for iOS
body: <p>I have an interesting problem I need to research related to very low level video streaming.</p>
  
  <p>Has anyone had any experience converting a raw stream of bytes(separated into per pixel information, but not a standard format of video) into a low resolution video stream? I believe that I can map the data into RGB value per pixel bytes, as the color values that correspond to the value in the raw data will be determined by us. I'm not sure where to go from there, or what the RGB format needs to be per pixel. </p>
  
  <p>I've looked at FFMPeg but it's documentation is massive and I don't know where to start.</p>
  
  <p>Specific questions I have include, is it possible to create CVPixelBuffer with that pixel data? If I were to do that, what sort of format for the per pixel data would I need to convert to? </p>
  
  <p>Also, should I be looking deeper into OpenGL, and if so where would the best place to look for information on this topic?</p>
  
  <p>What about CGBitmapContextCreate? For example, if I went I went with something like <a href="https://stackoverflow.com/a/1581805/695570">this</a>, what would a typical pixel byte need to look like? Would this be fast enough to keep the frame rate above 20fps?</p>
  
  <p><strong>EDIT</strong>:</p>
  
  <p>I think with the excellent help of you two, and some more research on my own, I've put together a plan for how to construct the raw RGBA data, then construct a CGImage from that data, in turn create a CVPixelBuffer from that CGImage from here <a href="https://stackoverflow.com/questions/3741323/how-do-i-export-uiimage-array-as-a-movie/3742212">CVPixelBuffer from CGImage</a>. </p>
  
  <p>However, to then play that live as the data comes in, I'm not sure what kind of FPS I would be looking at. Do I paint them to a CALayer, or is there some similar class to AVAssetWriter that I could use to play it as I append CVPixelBuffers. The experience that I have is using AVAssetWriter to export constructed CoreAnimation hierarchies to video, so the videos are always constructed before they begin playing, and not displayed as live video.</p>