[Ffmpeg-devel] AVFormat ffm reader generating incorrect PTS information

Michael Niedermayer michaelni
Tue Jan 17 17:57:08 CET 2006


On Tue, Jan 17, 2006 at 11:28:40AM -0500, Bryan Mayland wrote:
> I've been working with figuring out where all the "error, non monotone 
> timestamps..." messages were coming from when using ffserver. Debugging 
> into it, the ffm format reader seemed to be generating bogus PTS 
> information in the following cadence starting at the first frame of each 
> ffm packet:
> Frame 1: pts has just been read from the packet header, so when pts is 
> set on the frame it is valid.
> Frame 2: Gets the same pts counter as frame 1.  This value is fixed up 
> by compute_pkt_fields in av_read_frame_internal, and comes out with a 
> coincidently valid pts value on it.
> Frame 3-end of packet:  Gets the same pts coutner as frame 1.  
> compute_pkt_fields does not compensate as the pts disparity is too 
> great.  Now it looks to the receiver that the pts counter has gone 
> backward from frame 2.  All subsequent frames are non monotone until the 
> next ffm packet header is read and the pts is reset from the format context.
> The easy fix for this is to set the pts on the frame correctly when it 
> is read from the packet.  A one line fix is attached which seems to work 
> perfectly since the frame duration is read from the frame header.  I 
> don't know all the intricacies of ffmpeg though, so someone might want 
> to come back with a "you idiot, you just can't increment pts by frame 
> duration!".

how is this going to work with b frames? i dont know ffm/ffserver very wel
but somehow my feeling tells me that setting pts to AV_NOPTS_VALUE if its
not explicitly stored is the right thing to do 



More information about the ffmpeg-devel mailing list