[FFmpeg-devel] [PATCH] [RFC] avformat: use "genpts" option for output file.
Benoit Fouet
benoit.fouet at free.fr
Tue Nov 4 15:19:36 CET 2014
Hi,
----- Mail original -----
> On Tue, Nov 04, 2014 at 02:32:55PM +0100, Benoit Fouet wrote:
> > Hi,
> >
> > ----- Mail original -----
> > > On Tue, Nov 04, 2014 at 01:15:02PM +0100, Benoit Fouet wrote:
> > > > Hi,
> > > >
> > > > ----- Mail original -----
> > > > > On Mon, Nov 03, 2014 at 03:21:33PM +0100, Benoit Fouet wrote:
> > > > > > When "-fflags +genpts" is used for output file, use dts as
> > > > > > pts.
> > > > > >
> > > > > > Signed-off-by: Benoit Fouet <benoit.fouet at free.fr>
> > > > > > ---
> > > > > > libavformat/mux.c | 3 +++
> > > > > > 1 file changed, 3 insertions(+)
> > > > > >
> > > > > > diff --git a/libavformat/mux.c b/libavformat/mux.c
> > > > > > index 5e45bd8..1d42451 100644
> > > > > > --- a/libavformat/mux.c
> > > > > > +++ b/libavformat/mux.c
> > > > > > @@ -884,6 +884,9 @@ int
> > > > > > av_interleaved_write_frame(AVFormatContext
> > > > > > *s, AVPacket *pkt)
> > > > > > ret = AVERROR(EINVAL);
> > > > > > goto fail;
> > > > > > }
> > > > > > +
> > > > > > + if (pkt->pts == AV_NOPTS_VALUE && s->flags &
> > > > > > AVFMT_FLAG_GENPTS)
> > > > > > + pkt->pts = pkt->dts;
> > > > >
> > > > > does this set pts to invalid value for h264 with b frames or
> > > > > b pyramid ?
> > > > >
> > > >
> > > > No.
> > >
> > > how did you test this ?
> > > can you show an example of b pyramid and the filled in PTS values
> > >
> >
> > Oh... I only tested stream copy. And this is the only thing I want
> > to fix. I should ensure this is only used for this case, right?
> > I think this can mess things up if used with "real" transcoding...
>
> no, you misunderstand i think
>
>
indeed.
> consider
> raw.h264 originally encoded with B pyramid
> IPBBBPBBB
> PTS ????????? <-- these are actually stored in the h264 one way
> or another but not read
> DTS 012345678
>
> Correct (stream copy into file.ts, file.mkv and others)
> IPBBBPBBB
> PTS 26435A879
> DTS 012345678
>
> what i suspect this patch creates:
> PTS 012345678
> DTS 012345678
>
This seems to be what this patch creates, yes.
So I get a lot of "Application provided invalid, non monotonically increasing dts to muxer in stream 0: XXXX >= YYYY" error messages when processing the output generated by the genpts with this patch applied...
--
Ben
More information about the ffmpeg-devel
mailing list