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

Paul Curtis pfc
Fri Oct 7 12:38:09 CEST 2005


Rich Felker wrote:

>>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?
> 
> There's not necessarily a framerate. Framerate only makes sense if all
> the frames have same duration.

I should have been clearer. I have video streams of a fixed framerate 
which does not change throughout the whole stream. In this case, I *did* 
  assume that each returned frame from avcodec_decode_video() was 
compete, and calculated the timing based on that. This works correctly 
with a fixed framerate.

However, you stated that this only makes sense if all the frames have 
the same duration. Since there is NO method to determine this fact from 
the APIs, then your point is moot. If there IS a way to determine the 
appropriate duration for a single, decoded frame, I haven't found it by 
searching the code or the mailing lists. If you know how to do this, 
then please let me know.

>>Should I be calculating the audio timing the same way?
> 
> No, since it doesn't work.. :)

Again, I should have been clearer. I was asking whether I should be 
calculating the timing rather than relying on AVPacket.pts or AVFrame.pts.

>>Should the timings start at zero?
> 
> Not necessarily.

I've examined the AVStream.start_time for the streams. They have a value 
  which is the same for the video and audio streams. Are there any other 
values I should examine?

Paul





More information about the ffmpeg-devel mailing list