[FFmpeg-devel] libavformat/utils.c/compute_pkt_fields2: calculate dts from pts

Michael Niedermayer michaelni
Tue Oct 9 14:14:13 CEST 2007

On Tue, Oct 09, 2007 at 08:59:18AM +0200, Dirk Musfeldt wrote:
> Hi,
> I'm using libavformat to re-mux an MPEG TS to PS. When feeding the PES into
> av_write_frame() I'm getting log messages of "error, non monotone
> timestamps" .
> So I was thinking about compute_pkt_fields2(). Is the algorithm to compute
> dts from pts really working as expected?
> It will probably work fine if either no packet has a valid dts (i.e. every
> packet has dts value AV_NOPTS_VALUE) or every packet has a valid dts value
> (which is the trivial case).
> But what if the I-frames and P-frames have valid dts but the B-frames don't?
> In this case only the pts values from B-frames are stored into
> st->pts_buffer. 
> Let's assume that the stream has packets P2 B0 B1 P5 B3 B4 where the digit
> indicates the PTS value. P5 has dts value 2 while the B-frames don't have
> dts values.
> When computing dts for B3 the table st->pts_buffer will have the pts values
> 1 and 3, so that dts value for B3 becomes 1.
> But we have already seen P2 so that st->cur_dts is already 2 which gives the
> error message while the stream itself is perfectly valid.
> What do you think?

i think this is the wrong mailinglist, this belongs to ffmpeg-user
and you need a valid timestamp to mux a frame

also, if you want to send us a bugreport see our bugreporting guide
but at minimum we need a command line for ffmpeg and a sample file which
show the problem

Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

The greatest way to live with honor in this world is to be what we pretend
to be. -- Socrates
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20071009/ff973b02/attachment.pgp>

More information about the ffmpeg-devel mailing list