[FFmpeg-devel] [PATCH] correctly set h264 field timestamp

Baptiste Coudurier baptiste.coudurier
Tue Jun 16 23:58:19 CEST 2009

Michael Niedermayer wrote:
> On Sun, Jun 14, 2009 at 11:18:20PM -0700, Baptiste Coudurier wrote:
>> Hi,
>> $subject.
>> Add check for next_frame_offset because the condition !s->frame_offset
>> is valid for both first fields in a stream, however the timestamp refers
>> to the first field.
>> This is only needed for the second field.
> is it correct (aka do we want it) that s->frame_offset is 0 for the 2nd field?

Well, if we do not want s->frame_offset to be 0 for 2nd then we have to
change the logic setting s->frame_offset.

Scenario is:
first PES packet containing 2 fields enter parser.
First field is output, s->next_frame_offset is set.
remaining packet enters parser
nothing is output.
second PES packet containing 2 fields enter parser.
Second field of first PES packet is output, pts/dts are fetch and values
are the ones of the first PES packet which is wrong and cause problems.

s->frame_offset is updated when something is output.

> if yes then my gut feeling says this fix is not enough to associate
> timestamps for field based h264 correctly, but maybe iam missing something

This case only happens for first 2 field in a stream. First field has
s->frame_offset and s->next_frame_offset as 0, Second field has
s->frame_offset as 0 and s->next_frame_offset set.

Baptiste COUDURIER                              GnuPG Key Id: 0x5C1ABAAA
Key fingerprint                 8D77134D20CC9220201FC5DB0AC9325C5C1ABAAA
FFmpeg maintainer                                  http://www.ffmpeg.org

More information about the ffmpeg-devel mailing list