[Ffmpeg-devel] Audio and Video Frame Start/End Time

Paul Curtis pfc
Thu Oct 6 17:51:52 CEST 2005

I have moved on to the next level of this application. Basically, it 
uses ffmpeg to read an MPEG2 stream, and pass the decoded audio and 
video to the Helix Producer SDK. This works, but I'm having some 
problems obtaining timing information.

The Helix SDK requires a start time and end time (in milliseconds) for 
each "sample" provided. So, for example, I decode the audio, use the 
pkt.pts, and calculate the audio "end time" based on channels & sample rate.

The video, however, is posing a problem. Since (as I read in an earlier 
thread) that the AVPacket.pts value is not necessarily valid, I need to 
calculate the video timing myself.

My question is whether each frame decoded represents one frame of video 
at the input frame rate. In other words, if I keep a count of the number 
of frames decoded, and calculate the start and end times based on the 
frame rate, is this the correct method? Have others found this same problem?

Should I be calculating the audio timing the same way?

Should the timings start at zero?


More information about the ffmpeg-devel mailing list