[FFmpeg-devel] [PATCH 3/3] libavcodec/v4l2_m2m_dec: set default time base

Lukas Rusak lorusak at gmail.com
Tue Jan 9 02:03:15 EET 2018


I'm not really sure what to do then.

Should I just replace time_base with pkt_timebase instead?

Or

Should I just remove the time base rescaling completely in v4l2_set_pts and
v4l2_get_pts as it seems to be 1:1 anyways.
On Mon, Jan 8, 2018 at 3:45 PM wm4 <nfxjfg at googlemail.com> wrote:

> On Mon,  8 Jan 2018 15:27:39 -0800
> Lukas Rusak <lorusak at gmail.com> wrote:
>
> > This default time base should be set in order for ffmpeg to rescale the
> timebase in v4l2_get_pts and v4l2_set_pts
> >
> > ---
> >  libavcodec/v4l2_m2m_dec.c | 2 ++
> >  1 file changed, 2 insertions(+)
> >
> > diff --git a/libavcodec/v4l2_m2m_dec.c b/libavcodec/v4l2_m2m_dec.c
> > index 8308613978..4de091a011 100644
> > --- a/libavcodec/v4l2_m2m_dec.c
> > +++ b/libavcodec/v4l2_m2m_dec.c
> > @@ -177,6 +177,8 @@ static av_cold int v4l2_decode_init(AVCodecContext
> *avctx)
> >      capture->av_codec_id = AV_CODEC_ID_RAWVIDEO;
> >      capture->av_pix_fmt = avctx->pix_fmt;
> >
> > +    avctx->time_base = AV_TIME_BASE_Q;
> > +
> >      ret = ff_v4l2_m2m_codec_init(avctx);
> >      if (ret) {
> >          av_log(avctx, AV_LOG_ERROR, "can't configure decoder\n");
>
> Decoders in FFmpeg don't really have a concept of a timebase. If they
> do, they should not use avctx->time_base, but avctx->pkt_timebase.
>
> (I don't think avctx->pkt_timebase even needs to be set - API users
> normally expect that the decoder simply passes through timestamps,
> regardless of timebase. But if pkt_timebase is set, it should be the
> same timebase that AVPacket uses, and the output AVFrames must use the
> same timebase.
>
> avctx->time_base doesn't really mean anything for decoding. There is an
> obscure "other" use of it that has been deprecated, and the replacement
> has the same obscure use (see doxygen).
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>


More information about the ffmpeg-devel mailing list