[FFmpeg-devel] [PATCH] AVCHD/H.264 parser: determination of frame type, question about timestamps

Ivan Schreter schreter
Fri Jan 23 20:35:50 CET 2009


Hi,

Michael Niedermayer wrote:
> On Fri, Jan 23, 2009 at 02:40:57PM +0100, Nico Sabbi wrote:
>   
>> On Friday 23 January 2009 09:02:20 Ivan Schreter wrote:
>>     
>>> There is also a change in mpegts (code from Baptiste):
>>>
>>>     --- libavformat/mpegts.c        (revision 16686)
>>>     +++ libavformat/mpegts.c        (working copy)
>>>     @@ -888,7 +888,7 @@
>>>                      pes->pts = AV_NOPTS_VALUE;
>>>                      pes->dts = AV_NOPTS_VALUE;
>>>                      if ((flags & 0xc0) == 0x80) {
>>>     -                    pes->pts = get_pts(r);
>>>     +                    pes->dts = pes->pts = get_pts(r);
>>>                          r += 5;
>>>                      } else if ((flags & 0xc0) == 0xc0) {
>>>                          pes->pts = get_pts(r);
>>>
>>> this makes sure that frames having only PTS will get the same DTS
>>> (note: only for mpegts). Otherwise, libavformat gets confused and
>>> computes wrong DTS timestamps, which in turn results in
>>> dropping/duplicating frames in ffmpeg.c while recoding.
>>>       
>> this patch is wrong: if the DTS is not set in the PES there's no 
>> reason to assum that it's equal to the PTS. If it's a workround for a 
>> bug in the parser the parser should be fixed instead
>>     
> no, you too should read the spec again :)
> --------
> H.222.0 2.7.5
> ...
>     A decoding_timestamp (DTS) shall appear in a PES packet header if and only if the following two conditions are met:
>              a PTS is present in the PES packet header;
>              the decoding time differs from the presentation time.
> --------
>
> Now if a pts is present in the PES packet header AND dts!=pts then by this
> rule the pts AND dts MUST be coded. The fact that it is not in this branch
> implicates that pts==dts
>   
I also read the specs and agree with you. So the attached mini-patch in 
is IMHO OK.

Who is actually responsible for / can submit changes in the mpegts.c code?

Regards,

Ivan

-------------- next part --------------
A non-text attachment was scrubbed...
Name: patch_dts.diff
Type: text/x-patch
Size: 559 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20090123/d9a735fd/attachment.bin>



More information about the ffmpeg-devel mailing list