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

Bryan Mayland bmayland
Tue Jan 17 17:28:40 CET 2006

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 
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: ffm_pts_inc.diff
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20060117/eba118a6/attachment.txt>

More information about the ffmpeg-devel mailing list