title: Syncing decoded video using Ffmpeg
body: <p>I am using Ffmpeg to decode and play video files. I have currently got the video playing and the audio playing at as fast as the CPU can decode and display them. The problem is that I want to play the video and audio in sync using the system clock.</p>
  
  <p>I've searched around for some help but can't find anything substantial other than dranger's <a href="http://dranger.com/ffmpeg/tutorial05.html" rel="nofollow">tutorial 05</a> but I don't really understand what he is doing because my program isn't written in the same way as his.</p>
  
  <p>I am using mjpeg files and so the pts seems to be retrieved every single time a frame is decoded, I have multiplied the pts by the time_base as dranger does to get the value in seconds but the resolution seems to be only seconds and so I get the value "6" 25 times and then "7" 25 times as the video runs at 25 frames per second.</p>
  
  <p>Is there not a more accurate value? Or way to get a more accurate value and if so, how would I go about syncing to this value? I am using SDL to display the value so can I just use a SDL_Delay() of the value I get?</p>
  
  <p>Thanks for your time,</p>
  
  <p>Infinitifizz</p>