[FFmpeg-devel] [PATCH] ffmpeg.c: Fallback to duration_dts, when duration_pts can't be determined.

Thomas Mundt tmundt75 at gmail.com
Tue Oct 10 21:34:41 EEST 2017


2017-10-10 19:44 GMT+02:00 wm4 <nfxjfg at googlemail.com>:

> On Tue, 10 Oct 2017 10:36:58 -0700
> Sasi Inguva <isasi-at-google.com at ffmpeg.org> wrote:
>
> > This is required for FLV files, for which duration_pts comes out to be
> zero.
> >
> > Signed-off-by: Sasi Inguva <isasi at google.com>
> > ---
> >  fftools/ffmpeg.c | 9 +++++++--
> >  1 file changed, 7 insertions(+), 2 deletions(-)
> >
> > diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c
> > index 6d64bc1043..3ee31473dc 100644
> > --- a/fftools/ffmpeg.c
> > +++ b/fftools/ffmpeg.c
> > @@ -2665,8 +2665,13 @@ static int process_input_packet(InputStream
> *ist, const AVPacket *pkt, int no_eo
> >                      ist->next_dts = AV_NOPTS_VALUE;
> >              }
> >
> > -            if (got_output)
> > -                ist->next_pts += av_rescale_q(duration_pts,
> ist->st->time_base, AV_TIME_BASE_Q);
> > +            if (got_output) {
> > +                if (duration_pts > 0) {
> > +                    ist->next_pts += av_rescale_q(duration_pts,
> ist->st->time_base, AV_TIME_BASE_Q);
> > +                } else {
> > +                    ist->next_pts += duration_dts;
> > +                }
> > +            }
> >              break;
> >          case AVMEDIA_TYPE_SUBTITLE:
> >              if (repeating)
>
> So why can't duration_pts be 0?
>

Hmm, to my understanding that would be a frame with no duration. Virtually
an invisible frame.
Can you give an example?


More information about the ffmpeg-devel mailing list