title: How to use VideoToolbox to decompress H.264 video stream
body: <p>I had a lot of trouble figuring out how to use Apple's Hardware accelerated video framework to decompress an H.264 video stream.  After a few weeks I figured it out and wanted to share an extensive example since I couldn't find one.</p>
  
  <p>My goal is to give a thorough, instructive example of Video Toolbox introduced in <a href="https://developer.apple.com/videos/wwdc/2014/#513">WWDC '14 session 513</a>.  My code will not compile or run since it needs to be integrated with an elementary H.264 stream (like a video read from a file or streamed from online etc) and needs to be tweaked depending on the specific case.  </p>
  
  <p>I should mention that I have very little experience with video en/decoding except what I learned while googling the subject.  I don't know all the details about video formats, parameter structure etc. so I've only included what I think you need to know.</p>
  
  <p>I am using XCode 6.2 and have deployed to iOS devices that are running iOS 8.1 and 8.2.</p>