[FFmpeg-devel] [PATCH 3/3] Only set starttime to pts when pts and dts agree

Måns Rullgård mans
Wed Mar 2 18:58:33 CET 2011


Benjamin Larsson <banan at ludd.ltu.se> writes:

> On 03/02/2011 06:32 PM, M?ns Rullg?rd wrote:
>> Benjamin Larsson <benjamin at southpole.se> writes:
>>
>>> ---
>>>  libavformat/utils.c |    2 +-
>>>  1 files changed, 1 insertions(+), 1 deletions(-)
>>>
>>> diff --git a/libavformat/utils.c b/libavformat/utils.c
>>> index c8e16ba..7627364 100644
>>> --- a/libavformat/utils.c
>>> +++ b/libavformat/utils.c
>>> @@ -872,7 +872,7 @@ static void update_initial_timestamps(AVFormatContext *s, int stream_index,
>>>              st->start_time= pktl->pkt.pts;
>>>      }
>>>      if (st->start_time == AV_NOPTS_VALUE)
>>> -        st->start_time = pts;
>>> +        st->start_time = pts==dts ? pts : AV_NOPTS_VALUE;
>>>  }
>>>  
>>>  static void update_initial_durations(AVFormatContext *s, AVStream *st, AVPacket *pkt)
>>> -- 
>>> 1.7.1
>> What is this intended to fix?  Why should this be done only if pts and
>> dts are equal, i.e. no decoder delay?
>
> mpeg 2 mov file duration gets messed up when the files starts with a b
> frame.
>
> pts in the file is 200,0, etc.

MPEG2 B-frames are required to have pts=dts.

What does your patch do to a typical MPEG2 stream starting with an
I-frame with pts != dts?

-- 
M?ns Rullg?rd
mans at mansr.com



More information about the ffmpeg-devel mailing list