title: How to hardcode a MP4 stream file with iOS VideoToolbox and FFMPEG?
body: <p>Guys!</p>
  
  <p>I have found a demo in github that is :<a href="https://github.com/adison/-VideoToolboxDemo/blob/master/testFrameExtractor/testFrameExtractor/SuperVideoFrameExtractor.m" rel="nofollow noreferrer">-VideoToolboxDemo</a>. And I also found a question in stackoverflow <a href="https://stackoverflow.com/questions/29525000/how-to-use-videotoolbox-to-decompress-h-264-video-stream">how-to-use-videotoolbox-to-decompress-h-264-video-stream</a> which someone has implemented in github:https:/ /github.com/lileilei1119/VTDemo</p>
  
  <p>But there is a different between they in finding SPS and PPS.</p>
  
  <p>The VideoToolboxDemo is: </p>
  
  <pre><code>uint8_t *data = pCodecCtx -&gt; extradata;
  int size = pCodecCtx -&gt; extradata_size;
  </code></pre>
  
  <p>it uses extradata of pCodecCtx from FFMPEG to find start code like 0x00 00 01(or 0x00 00 00 01)</p>
  
  <p>but the introduction in stackoverflow is:</p>
  
  <pre><code>[_h264Decoder decodeFrame:packet.data withSize:packet.size];
  </code></pre>
  
  <p>use data of packet?</p>
  
  <p>I have try these two ways, but I still can't find start code of SPS and PPS. Does anyone know why? Is there something wrong in my file?  </p>
  
  <p>My mp4 file is http:/ /7u2m53.com1.z0.glb.clouddn.com/201601131107187320.mp4</p>