title: Wrong Presentation time at H264 streams [Live555 OpenRtspClient]
body: <p>I modify the OpenRtspClient so that</p>
  
  <ul>
  <li><p>Now instead of writing frames to file I collect them in a queue  with incoming presenttaion times</p></li>
  <li><p>Then give the h264 frames to MP4 muxer [ Geraint Davies MP4 mux filter]</p></li>
  <li>Finally write muxed data to file...</li>
  </ul>
  
  <p>So I can able to save h264 stream into MP4 container...</p>
  
  <blockquote>
    <p>But the problem is that, some of the recorded data [NOT all of them]
    has wrong values for time duration:</p>
  </blockquote>
  
  <p>Suppose that a 10 minute record seems that it was 12 h stream...
  VLC play the 10 minute that play last  frame for the remaing time.</p>
  
  <p>It seems that i set   sample times wrong into the Muxer...
  Then i debug and see that there is positive and negative dramatic jumps at time stamps...</p>
  
  <p>Here is  how i set time stamps:</p>
  
  <ul>
  <li>Firts i take presentationTime from H264VideoFileSink::afterGettingFrame1 function</li>
  <li>Then calculate the firstPresentaionTime [ at the beginning]</li>
  <li>Then collect other timestamps</li>
  </ul>
  
  <p>And I see that frameTimeStamp values show dramatic jumps to negative or positive values...[ i keeep those values as int64 ]</p>
  
  <pre><code>#define TIMEVAL_TO_REFERENCE_TIME(x) 
        ((__int64)(x.tv_sec * 1000000) + x.tv_usec) * 10
  
  void  H264VideoFileSink::
   afterGettingFrame1(unsigned frameSize, struct timeval presentationTime) 
  {
  
      // At the beginning [ just for once calculate firstPresentaionTime ]
  
      firstPresentaionTime = TIMEVAL_TO_REFERENCE_TIME(presentationTime);
  
      // for the other frames collect frames timestamps
  
      frameTimeStamp = TIMEVAL_TO_REFERENCE_TIME(presentationTime) - 
  firstPresentationTime
  
      }
  </code></pre>
  
  <p>What my cause this? </p>
  
  <ul>
  <li>Or is it  agood idea to use this "presentationTime"  for a MP4 Muxer?</li>
  <li>Where the "presentationTime" is calculated at library?</li>
  <li>Is it possible that   H264VideoFileSink::afterGettingFrame1 method "presentationTime" values may be wrong?</li>
  <li>Anybody record h264 stream in  a mp4 contianer and wanted to share his/her experience?</li>
  </ul>