diff mbox

[FFmpeg-devel,v1] lavf/mov: Fix timestamp rescale on sidx atom

Message ID 20190509090756.5684-1-junli1026@gmail.com
State Accepted
Commit c23797bc336c507188a502a5758b24a4595f14ec
Headers show

Commit Message

Jun Li May 9, 2019, 9:07 a.m. UTC
Fix #5090
Fix the timestamp rescale issue, from sidx timebase to
stream's timebase.
---
 libavformat/mov.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Jun Li May 11, 2019, 2:25 a.m. UTC | #1
On Thu, May 9, 2019 at 2:08 AM Jun Li <junli1026@gmail.com> wrote:

> Fix #5090
> Fix the timestamp rescale issue, from sidx timebase to
> stream's timebase.
> ---
>  libavformat/mov.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/libavformat/mov.c b/libavformat/mov.c
> index 78f692872b..d058855e6c 100644
> --- a/libavformat/mov.c
> +++ b/libavformat/mov.c
> @@ -5017,7 +5017,7 @@ static int mov_read_sidx(MOVContext *c, AVIOContext
> *pb, MOVAtom atom)
>              return AVERROR_PATCHWELCOME;
>          }
>          avio_rb32(pb); // sap_flags
> -        timestamp = av_rescale_q(pts, st->time_base, timescale);
> +        timestamp = av_rescale_q(pts, timescale, st->time_base);
>
>          index = update_frag_index(c, offset);
>          frag_stream_info = get_frag_stream_info(&c->frag_index, index,
> track_id);
> --
> 2.17.1
>

Ping
Jun Li May 13, 2019, 2:44 a.m. UTC | #2
On Fri, May 10, 2019 at 7:25 PM Jun Li <junli1026@gmail.com> wrote:

>
> On Thu, May 9, 2019 at 2:08 AM Jun Li <junli1026@gmail.com> wrote:
>
>> Fix #5090
>> Fix the timestamp rescale issue, from sidx timebase to
>> stream's timebase.
>> ---
>>  libavformat/mov.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/libavformat/mov.c b/libavformat/mov.c
>> index 78f692872b..d058855e6c 100644
>> --- a/libavformat/mov.c
>> +++ b/libavformat/mov.c
>> @@ -5017,7 +5017,7 @@ static int mov_read_sidx(MOVContext *c, AVIOContext
>> *pb, MOVAtom atom)
>>              return AVERROR_PATCHWELCOME;
>>          }
>>          avio_rb32(pb); // sap_flags
>> -        timestamp = av_rescale_q(pts, st->time_base, timescale);
>> +        timestamp = av_rescale_q(pts, timescale, st->time_base);
>>
>>          index = update_frag_index(c, offset);
>>          frag_stream_info = get_frag_stream_info(&c->frag_index, index,
>> track_id);
>> --
>> 2.17.1
>>
>
> Ping
>

This change is for fix the issue of calculating sidx_pts.
Sidx box has "earliest_presentation_time", used as pts of  the referent
track, sidx also has timescale field.
So the operation should convert from sidx's timescale to track's timescale,
this patch is for addressing this, as well as fixing #5090.

Of course this is based on my understanding, so please correct me if I am
wrong. Thanks !

Best Regards,
Jun
Jun Li May 16, 2019, 8 a.m. UTC | #3
On Sun, May 12, 2019 at 7:44 PM Jun Li <junli1026@gmail.com> wrote:

>
>
> On Fri, May 10, 2019 at 7:25 PM Jun Li <junli1026@gmail.com> wrote:
>
>>
>> On Thu, May 9, 2019 at 2:08 AM Jun Li <junli1026@gmail.com> wrote:
>>
>>> Fix #5090
>>> Fix the timestamp rescale issue, from sidx timebase to
>>> stream's timebase.
>>> ---
>>>  libavformat/mov.c | 2 +-
>>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>>
>>> diff --git a/libavformat/mov.c b/libavformat/mov.c
>>> index 78f692872b..d058855e6c 100644
>>> --- a/libavformat/mov.c
>>> +++ b/libavformat/mov.c
>>> @@ -5017,7 +5017,7 @@ static int mov_read_sidx(MOVContext *c,
>>> AVIOContext *pb, MOVAtom atom)
>>>              return AVERROR_PATCHWELCOME;
>>>          }
>>>          avio_rb32(pb); // sap_flags
>>> -        timestamp = av_rescale_q(pts, st->time_base, timescale);
>>> +        timestamp = av_rescale_q(pts, timescale, st->time_base);
>>>
>>>          index = update_frag_index(c, offset);
>>>          frag_stream_info = get_frag_stream_info(&c->frag_index, index,
>>> track_id);
>>> --
>>> 2.17.1
>>>
>>
>> Ping
>>
>
> This change is for fix the issue of calculating sidx_pts.
> Sidx box has "earliest_presentation_time", used as pts of  the referent
> track, sidx also has timescale field.
> So the operation should convert from sidx's timescale to track's
> timescale, this patch is for addressing this, as well as fixing #5090.
>
> Of course this is based on my understanding, so please correct me if I am
> wrong. Thanks !
>
>
Ping.
I believe this is a bug and triggered whenever sidx box's timescale is
different from track's timescale.
Created this kind of content and verified that ffplay couldn't play while
VLC plays well.
Then I checked VLC's implementation:
https://github.com/videolan/vlc/blob/5609c1b41d6fbca6323103619c6139caf7bc9e6e/modules/demux/mp4/mp4.c#L4735

Hope someone could help to have a review ? Thanks ! :)

Best Regards,
-Jun


> Best Regards,
> Jun
>
>
>
>
Jun Li May 21, 2019, 8:05 a.m. UTC | #4
On Thu, May 16, 2019 at 1:00 AM Jun Li <junli1026@gmail.com> wrote:

>
>
> On Sun, May 12, 2019 at 7:44 PM Jun Li <junli1026@gmail.com> wrote:
>
>>
>>
>> On Fri, May 10, 2019 at 7:25 PM Jun Li <junli1026@gmail.com> wrote:
>>
>>>
>>> On Thu, May 9, 2019 at 2:08 AM Jun Li <junli1026@gmail.com> wrote:
>>>
>>>> Fix #5090
>>>> Fix the timestamp rescale issue, from sidx timebase to
>>>> stream's timebase.
>>>> ---
>>>>  libavformat/mov.c | 2 +-
>>>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>>>
>>>> diff --git a/libavformat/mov.c b/libavformat/mov.c
>>>> index 78f692872b..d058855e6c 100644
>>>> --- a/libavformat/mov.c
>>>> +++ b/libavformat/mov.c
>>>> @@ -5017,7 +5017,7 @@ static int mov_read_sidx(MOVContext *c,
>>>> AVIOContext *pb, MOVAtom atom)
>>>>              return AVERROR_PATCHWELCOME;
>>>>          }
>>>>          avio_rb32(pb); // sap_flags
>>>> -        timestamp = av_rescale_q(pts, st->time_base, timescale);
>>>> +        timestamp = av_rescale_q(pts, timescale, st->time_base);
>>>>
>>>>          index = update_frag_index(c, offset);
>>>>          frag_stream_info = get_frag_stream_info(&c->frag_index, index,
>>>> track_id);
>>>> --
>>>> 2.17.1
>>>>
>>>
>>> Ping
>>>
>>
>> This change is for fix the issue of calculating sidx_pts.
>> Sidx box has "earliest_presentation_time", used as pts of  the referent
>> track, sidx also has timescale field.
>> So the operation should convert from sidx's timescale to track's
>> timescale, this patch is for addressing this, as well as fixing #5090.
>>
>> Of course this is based on my understanding, so please correct me if I am
>> wrong. Thanks !
>>
>>
> Ping.
> I believe this is a bug and triggered whenever sidx box's timescale is
> different from track's timescale.
> Created this kind of content and verified that ffplay couldn't play while
> VLC plays well.
> Then I checked VLC's implementation:
>
> https://github.com/videolan/vlc/blob/5609c1b41d6fbca6323103619c6139caf7bc9e6e/modules/demux/mp4/mp4.c#L4735
>
> Hope someone could help to have a review ? Thanks ! :)
>
> Best Regards,
> -Jun
>
>
>> Best Regards,
>> Jun
>>
>
Ping x 3
Jun Li June 20, 2019, 9:02 a.m. UTC | #5
On Tue, May 21, 2019 at 1:05 AM Jun Li <junli1026@gmail.com> wrote:

>
>
> On Thu, May 16, 2019 at 1:00 AM Jun Li <junli1026@gmail.com> wrote:
>
>>
>>
>> On Sun, May 12, 2019 at 7:44 PM Jun Li <junli1026@gmail.com> wrote:
>>
>>>
>>>
>>> On Fri, May 10, 2019 at 7:25 PM Jun Li <junli1026@gmail.com> wrote:
>>>
>>>>
>>>> On Thu, May 9, 2019 at 2:08 AM Jun Li <junli1026@gmail.com> wrote:
>>>>
>>>>> Fix #5090
>>>>> Fix the timestamp rescale issue, from sidx timebase to
>>>>> stream's timebase.
>>>>> ---
>>>>>  libavformat/mov.c | 2 +-
>>>>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>>>>
>>>>> diff --git a/libavformat/mov.c b/libavformat/mov.c
>>>>> index 78f692872b..d058855e6c 100644
>>>>> --- a/libavformat/mov.c
>>>>> +++ b/libavformat/mov.c
>>>>> @@ -5017,7 +5017,7 @@ static int mov_read_sidx(MOVContext *c,
>>>>> AVIOContext *pb, MOVAtom atom)
>>>>>              return AVERROR_PATCHWELCOME;
>>>>>          }
>>>>>          avio_rb32(pb); // sap_flags
>>>>> -        timestamp = av_rescale_q(pts, st->time_base, timescale);
>>>>> +        timestamp = av_rescale_q(pts, timescale, st->time_base);
>>>>>
>>>>>          index = update_frag_index(c, offset);
>>>>>          frag_stream_info = get_frag_stream_info(&c->frag_index,
>>>>> index, track_id);
>>>>> --
>>>>> 2.17.1
>>>>>
>>>>
>>>> Ping
>>>>
>>>
>>> This change is for fix the issue of calculating sidx_pts.
>>> Sidx box has "earliest_presentation_time", used as pts of  the referent
>>> track, sidx also has timescale field.
>>> So the operation should convert from sidx's timescale to track's
>>> timescale, this patch is for addressing this, as well as fixing #5090.
>>>
>>> Of course this is based on my understanding, so please correct me if I
>>> am wrong. Thanks !
>>>
>>>
>> Ping.
>> I believe this is a bug and triggered whenever sidx box's timescale is
>> different from track's timescale.
>> Created this kind of content and verified that ffplay couldn't play while
>> VLC plays well.
>> Then I checked VLC's implementation:
>>
>> https://github.com/videolan/vlc/blob/5609c1b41d6fbca6323103619c6139caf7bc9e6e/modules/demux/mp4/mp4.c#L4735
>>
>> Hope someone could help to have a review ? Thanks ! :)
>>
>> Best Regards,
>> -Jun
>>
>>
>>> Best Regards,
>>> Jun
>>>
>>
> Ping x 3
>

Ping x 4.
I believe this is an obvious bug and happened whenever sidx box's timescale
is different from track's timescale.
I created this kind of content and verified that ffplay couldn't play while
VLC plays well.
This is  VLC's implementation:
https://github.com/videolan/vlc/blob/5609c1b41d6fbca6323103619c6139caf7bc9e6e/modules/demux/mp4/mp4.c#L4735
Jun Li Aug. 15, 2019, 4:41 a.m. UTC | #6
On Thu, Jun 20, 2019 at 2:02 AM Jun Li <junli1026@gmail.com> wrote:

>
>
> On Tue, May 21, 2019 at 1:05 AM Jun Li <junli1026@gmail.com> wrote:
>
>>
>>
>> On Thu, May 16, 2019 at 1:00 AM Jun Li <junli1026@gmail.com> wrote:
>>
>>>
>>>
>>> On Sun, May 12, 2019 at 7:44 PM Jun Li <junli1026@gmail.com> wrote:
>>>
>>>>
>>>>
>>>> On Fri, May 10, 2019 at 7:25 PM Jun Li <junli1026@gmail.com> wrote:
>>>>
>>>>>
>>>>> On Thu, May 9, 2019 at 2:08 AM Jun Li <junli1026@gmail.com> wrote:
>>>>>
>>>>>> Fix #5090
>>>>>> Fix the timestamp rescale issue, from sidx timebase to
>>>>>> stream's timebase.
>>>>>> ---
>>>>>>  libavformat/mov.c | 2 +-
>>>>>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>>>>>
>>>>>> diff --git a/libavformat/mov.c b/libavformat/mov.c
>>>>>> index 78f692872b..d058855e6c 100644
>>>>>> --- a/libavformat/mov.c
>>>>>> +++ b/libavformat/mov.c
>>>>>> @@ -5017,7 +5017,7 @@ static int mov_read_sidx(MOVContext *c,
>>>>>> AVIOContext *pb, MOVAtom atom)
>>>>>>              return AVERROR_PATCHWELCOME;
>>>>>>          }
>>>>>>          avio_rb32(pb); // sap_flags
>>>>>> -        timestamp = av_rescale_q(pts, st->time_base, timescale);
>>>>>> +        timestamp = av_rescale_q(pts, timescale, st->time_base);
>>>>>>
>>>>>>          index = update_frag_index(c, offset);
>>>>>>          frag_stream_info = get_frag_stream_info(&c->frag_index,
>>>>>> index, track_id);
>>>>>> --
>>>>>> 2.17.1
>>>>>>
>>>>>
>>>>> Ping
>>>>>
>>>>
>>>> This change is for fix the issue of calculating sidx_pts.
>>>> Sidx box has "earliest_presentation_time", used as pts of  the referent
>>>> track, sidx also has timescale field.
>>>> So the operation should convert from sidx's timescale to track's
>>>> timescale, this patch is for addressing this, as well as fixing #5090.
>>>>
>>>> Of course this is based on my understanding, so please correct me if I
>>>> am wrong. Thanks !
>>>>
>>>>
>>> Ping.
>>> I believe this is a bug and triggered whenever sidx box's timescale is
>>> different from track's timescale.
>>> Created this kind of content and verified that ffplay couldn't play
>>> while VLC plays well.
>>> Then I checked VLC's implementation:
>>>
>>> https://github.com/videolan/vlc/blob/5609c1b41d6fbca6323103619c6139caf7bc9e6e/modules/demux/mp4/mp4.c#L4735
>>>
>>> Hope someone could help to have a review ? Thanks ! :)
>>>
>>> Best Regards,
>>> -Jun
>>>
>>>
>>>> Best Regards,
>>>> Jun
>>>>
>>>
>> Ping x 3
>>
>
> Ping x 4.
> I believe this is an obvious bug and happened whenever sidx box's
> timescale is different from track's timescale.
> I created this kind of content and verified that ffplay couldn't play
> while VLC plays well.
> This is  VLC's implementation:
>
> https://github.com/videolan/vlc/blob/5609c1b41d6fbca6323103619c6139caf7bc9e6e/modules/demux/mp4/mp4.c#L4735
>

Ping x 5
mypopy@gmail.com Aug. 15, 2019, 8:02 a.m. UTC | #7
On Thu, Aug 15, 2019 at 12:49 PM Jun Li <junli1026@gmail.com> wrote:
>
> On Thu, Jun 20, 2019 at 2:02 AM Jun Li <junli1026@gmail.com> wrote:
>
> >
> >
> > On Tue, May 21, 2019 at 1:05 AM Jun Li <junli1026@gmail.com> wrote:
> >
> >>
> >>
> >> On Thu, May 16, 2019 at 1:00 AM Jun Li <junli1026@gmail.com> wrote:
> >>
> >>>
> >>>
> >>> On Sun, May 12, 2019 at 7:44 PM Jun Li <junli1026@gmail.com> wrote:
> >>>
> >>>>
> >>>>
> >>>> On Fri, May 10, 2019 at 7:25 PM Jun Li <junli1026@gmail.com> wrote:
> >>>>
> >>>>>
> >>>>> On Thu, May 9, 2019 at 2:08 AM Jun Li <junli1026@gmail.com> wrote:
> >>>>>
> >>>>>> Fix #5090
> >>>>>> Fix the timestamp rescale issue, from sidx timebase to
> >>>>>> stream's timebase.
> >>>>>> ---
> >>>>>>  libavformat/mov.c | 2 +-
> >>>>>>  1 file changed, 1 insertion(+), 1 deletion(-)
> >>>>>>
> >>>>>> diff --git a/libavformat/mov.c b/libavformat/mov.c
> >>>>>> index 78f692872b..d058855e6c 100644
> >>>>>> --- a/libavformat/mov.c
> >>>>>> +++ b/libavformat/mov.c
> >>>>>> @@ -5017,7 +5017,7 @@ static int mov_read_sidx(MOVContext *c,
> >>>>>> AVIOContext *pb, MOVAtom atom)
> >>>>>>              return AVERROR_PATCHWELCOME;
> >>>>>>          }
> >>>>>>          avio_rb32(pb); // sap_flags
> >>>>>> -        timestamp = av_rescale_q(pts, st->time_base, timescale);
> >>>>>> +        timestamp = av_rescale_q(pts, timescale, st->time_base);
> >>>>>>
> >>>>>>          index = update_frag_index(c, offset);
> >>>>>>          frag_stream_info = get_frag_stream_info(&c->frag_index,
> >>>>>> index, track_id);
> >>>>>> --
> >>>>>> 2.17.1
> >>>>>>
> >>>>>
> >>>>> Ping
> >>>>>
> >>>>
> >>>> This change is for fix the issue of calculating sidx_pts.
> >>>> Sidx box has "earliest_presentation_time", used as pts of  the referent
> >>>> track, sidx also has timescale field.
> >>>> So the operation should convert from sidx's timescale to track's
> >>>> timescale, this patch is for addressing this, as well as fixing #5090.
> >>>>
> >>>> Of course this is based on my understanding, so please correct me if I
> >>>> am wrong. Thanks !
> >>>>
> >>>>
> >>> Ping.
> >>> I believe this is a bug and triggered whenever sidx box's timescale is
> >>> different from track's timescale.
> >>> Created this kind of content and verified that ffplay couldn't play
> >>> while VLC plays well.
> >>> Then I checked VLC's implementation:
> >>>
> >>> https://github.com/videolan/vlc/blob/5609c1b41d6fbca6323103619c6139caf7bc9e6e/modules/demux/mp4/mp4.c#L4735
> >>>
> >>> Hope someone could help to have a review ? Thanks ! :)
> >>>
> >>> Best Regards,
> >>> -Jun
> >>>
> >>>
> >>>> Best Regards,
> >>>> Jun
> >>>>
> >>>
> >> Ping x 3
> >>
> >
> > Ping x 4.
> > I believe this is an obvious bug and happened whenever sidx box's
> > timescale is different from track's timescale.
> > I created this kind of content and verified that ffplay couldn't play
> > while VLC plays well.
> > This is  VLC's implementation:
> >
> > https://github.com/videolan/vlc/blob/5609c1b41d6fbca6323103619c6139caf7bc9e6e/modules/demux/mp4/mp4.c#L4735
> >
>
> Ping x 5
Tested and verified with ffplay/ffprobe, now the sample video DTS is
monotonically increasing without wrap around.
Jun Li Sept. 24, 2019, 4:29 a.m. UTC | #8
On Thu, Aug 15, 2019 at 1:02 AM mypopy@gmail.com <mypopy@gmail.com> wrote:

> On Thu, Aug 15, 2019 at 12:49 PM Jun Li <junli1026@gmail.com> wrote:
> >
> > On Thu, Jun 20, 2019 at 2:02 AM Jun Li <junli1026@gmail.com> wrote:
> >
> > >
> > >
> > > On Tue, May 21, 2019 at 1:05 AM Jun Li <junli1026@gmail.com> wrote:
> > >
> > >>
> > >>
> > >> On Thu, May 16, 2019 at 1:00 AM Jun Li <junli1026@gmail.com> wrote:
> > >>
> > >>>
> > >>>
> > >>> On Sun, May 12, 2019 at 7:44 PM Jun Li <junli1026@gmail.com> wrote:
> > >>>
> > >>>>
> > >>>>
> > >>>> On Fri, May 10, 2019 at 7:25 PM Jun Li <junli1026@gmail.com> wrote:
> > >>>>
> > >>>>>
> > >>>>> On Thu, May 9, 2019 at 2:08 AM Jun Li <junli1026@gmail.com> wrote:
> > >>>>>
> > >>>>>> Fix #5090
> > >>>>>> Fix the timestamp rescale issue, from sidx timebase to
> > >>>>>> stream's timebase.
> > >>>>>> ---
> > >>>>>>  libavformat/mov.c | 2 +-
> > >>>>>>  1 file changed, 1 insertion(+), 1 deletion(-)
> > >>>>>>
> > >>>>>> diff --git a/libavformat/mov.c b/libavformat/mov.c
> > >>>>>> index 78f692872b..d058855e6c 100644
> > >>>>>> --- a/libavformat/mov.c
> > >>>>>> +++ b/libavformat/mov.c
> > >>>>>> @@ -5017,7 +5017,7 @@ static int mov_read_sidx(MOVContext *c,
> > >>>>>> AVIOContext *pb, MOVAtom atom)
> > >>>>>>              return AVERROR_PATCHWELCOME;
> > >>>>>>          }
> > >>>>>>          avio_rb32(pb); // sap_flags
> > >>>>>> -        timestamp = av_rescale_q(pts, st->time_base, timescale);
> > >>>>>> +        timestamp = av_rescale_q(pts, timescale, st->time_base);
> > >>>>>>
> > >>>>>>          index = update_frag_index(c, offset);
> > >>>>>>          frag_stream_info = get_frag_stream_info(&c->frag_index,
> > >>>>>> index, track_id);
> > >>>>>> --
> > >>>>>> 2.17.1
> > >>>>>>
> > >>>>>
> > >>>>> Ping
> > >>>>>
> > >>>>
> > >>>> This change is for fix the issue of calculating sidx_pts.
> > >>>> Sidx box has "earliest_presentation_time", used as pts of  the
> referent
> > >>>> track, sidx also has timescale field.
> > >>>> So the operation should convert from sidx's timescale to track's
> > >>>> timescale, this patch is for addressing this, as well as fixing
> #5090.
> > >>>>
> > >>>> Of course this is based on my understanding, so please correct me
> if I
> > >>>> am wrong. Thanks !
> > >>>>
> > >>>>
> > >>> Ping.
> > >>> I believe this is a bug and triggered whenever sidx box's timescale
> is
> > >>> different from track's timescale.
> > >>> Created this kind of content and verified that ffplay couldn't play
> > >>> while VLC plays well.
> > >>> Then I checked VLC's implementation:
> > >>>
> > >>>
> https://github.com/videolan/vlc/blob/5609c1b41d6fbca6323103619c6139caf7bc9e6e/modules/demux/mp4/mp4.c#L4735
> > >>>
> > >>> Hope someone could help to have a review ? Thanks ! :)
> > >>>
> > >>> Best Regards,
> > >>> -Jun
> > >>>
> > >>>
> > >>>> Best Regards,
> > >>>> Jun
> > >>>>
> > >>>
> > >> Ping x 3
> > >>
> > >
> > > Ping x 4.
> > > I believe this is an obvious bug and happened whenever sidx box's
> > > timescale is different from track's timescale.
> > > I created this kind of content and verified that ffplay couldn't play
> > > while VLC plays well.
> > > This is  VLC's implementation:
> > >
> > >
> https://github.com/videolan/vlc/blob/5609c1b41d6fbca6323103619c6139caf7bc9e6e/modules/demux/mp4/mp4.c#L4735
> > >
> >
> > Ping x 5
> Tested and verified with ffplay/ffprobe, now the sample video DTS is
> monotonically increasing without wrap around.
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".


Ping x 6
mypopy@gmail.com Sept. 24, 2019, 5:06 a.m. UTC | #9
On Tue, Sep 24, 2019 at 12:38 PM Jun Li <junli1026@gmail.com> wrote:
>
> On Thu, Aug 15, 2019 at 1:02 AM mypopy@gmail.com <mypopy@gmail.com> wrote:
>
> > On Thu, Aug 15, 2019 at 12:49 PM Jun Li <junli1026@gmail.com> wrote:
> > >
> > > On Thu, Jun 20, 2019 at 2:02 AM Jun Li <junli1026@gmail.com> wrote:
> > >
> > > >
> > > >
> > > > On Tue, May 21, 2019 at 1:05 AM Jun Li <junli1026@gmail.com> wrote:
> > > >
> > > >>
> > > >>
> > > >> On Thu, May 16, 2019 at 1:00 AM Jun Li <junli1026@gmail.com> wrote:
> > > >>
> > > >>>
> > > >>>
> > > >>> On Sun, May 12, 2019 at 7:44 PM Jun Li <junli1026@gmail.com> wrote:
> > > >>>
> > > >>>>
> > > >>>>
> > > >>>> On Fri, May 10, 2019 at 7:25 PM Jun Li <junli1026@gmail.com> wrote:
> > > >>>>
> > > >>>>>
> > > >>>>> On Thu, May 9, 2019 at 2:08 AM Jun Li <junli1026@gmail.com> wrote:
> > > >>>>>
> > > >>>>>> Fix #5090
> > > >>>>>> Fix the timestamp rescale issue, from sidx timebase to
> > > >>>>>> stream's timebase.
> > > >>>>>> ---
> > > >>>>>>  libavformat/mov.c | 2 +-
> > > >>>>>>  1 file changed, 1 insertion(+), 1 deletion(-)
> > > >>>>>>
> > > >>>>>> diff --git a/libavformat/mov.c b/libavformat/mov.c
> > > >>>>>> index 78f692872b..d058855e6c 100644
> > > >>>>>> --- a/libavformat/mov.c
> > > >>>>>> +++ b/libavformat/mov.c
> > > >>>>>> @@ -5017,7 +5017,7 @@ static int mov_read_sidx(MOVContext *c,
> > > >>>>>> AVIOContext *pb, MOVAtom atom)
> > > >>>>>>              return AVERROR_PATCHWELCOME;
> > > >>>>>>          }
> > > >>>>>>          avio_rb32(pb); // sap_flags
> > > >>>>>> -        timestamp = av_rescale_q(pts, st->time_base, timescale);
> > > >>>>>> +        timestamp = av_rescale_q(pts, timescale, st->time_base);
> > > >>>>>>
> > > >>>>>>          index = update_frag_index(c, offset);
> > > >>>>>>          frag_stream_info = get_frag_stream_info(&c->frag_index,
> > > >>>>>> index, track_id);
> > > >>>>>> --
> > > >>>>>> 2.17.1
> > > >>>>>>
> > > >>>>>
> > > >>>>> Ping
> > > >>>>>
> > > >>>>
> > > >>>> This change is for fix the issue of calculating sidx_pts.
> > > >>>> Sidx box has "earliest_presentation_time", used as pts of  the
> > referent
> > > >>>> track, sidx also has timescale field.
> > > >>>> So the operation should convert from sidx's timescale to track's
> > > >>>> timescale, this patch is for addressing this, as well as fixing
> > #5090.
> > > >>>>
> > > >>>> Of course this is based on my understanding, so please correct me
> > if I
> > > >>>> am wrong. Thanks !
> > > >>>>
> > > >>>>
> > > >>> Ping.
> > > >>> I believe this is a bug and triggered whenever sidx box's timescale
> > is
> > > >>> different from track's timescale.
> > > >>> Created this kind of content and verified that ffplay couldn't play
> > > >>> while VLC plays well.
> > > >>> Then I checked VLC's implementation:
> > > >>>
> > > >>>
> > https://github.com/videolan/vlc/blob/5609c1b41d6fbca6323103619c6139caf7bc9e6e/modules/demux/mp4/mp4.c#L4735
> > > >>>
> > > >>> Hope someone could help to have a review ? Thanks ! :)
> > > >>>
> > > >>> Best Regards,
> > > >>> -Jun
> > > >>>
> > > >>>
> > > >>>> Best Regards,
> > > >>>> Jun
> > > >>>>
> > > >>>
> > > >> Ping x 3
> > > >>
> > > >
> > > > Ping x 4.
> > > > I believe this is an obvious bug and happened whenever sidx box's
> > > > timescale is different from track's timescale.
> > > > I created this kind of content and verified that ffplay couldn't play
> > > > while VLC plays well.
> > > > This is  VLC's implementation:
> > > >
> > > >
> > https://github.com/videolan/vlc/blob/5609c1b41d6fbca6323103619c6139caf7bc9e6e/modules/demux/mp4/mp4.c#L4735
> > > >
> > >
> > > Ping x 5
> > Tested and verified with ffplay/ffprobe, now the sample video DTS is
> > monotonically increasing without wrap around.
> > _______________________________________________
> > ffmpeg-devel mailing list
> > ffmpeg-devel@ffmpeg.org
> > https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> >
> > To unsubscribe, visit link above, or email
> > ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
>
>
> Ping x 6
If no other comments, will apply after 24 hours, Thanks
diff mbox

Patch

diff --git a/libavformat/mov.c b/libavformat/mov.c
index 78f692872b..d058855e6c 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -5017,7 +5017,7 @@  static int mov_read_sidx(MOVContext *c, AVIOContext *pb, MOVAtom atom)
             return AVERROR_PATCHWELCOME;
         }
         avio_rb32(pb); // sap_flags
-        timestamp = av_rescale_q(pts, st->time_base, timescale);
+        timestamp = av_rescale_q(pts, timescale, st->time_base);
 
         index = update_frag_index(c, offset);
         frag_stream_info = get_frag_stream_info(&c->frag_index, index, track_id);