[FFmpeg-devel] Evaluation of flag AVFMT_TS_DISCONT

Philip Spitzlinger p.spitzlinger
Fri Dec 17 10:28:27 CET 2010

Hello everybody,

I am encounting problems when copying packets from MPEG2 Streams to a 
new MPEG2 stream using the function av_interleaved_write_packet(...)
It complains about "non monotone timestamps" as the previous packet and 
the packet to be written have the same timestamp as read from the source 

This is even due to the fact that the output format has the flag 
AVFMT_TS_DISCONT set, which as documented in avformat.h explicitly 
allows non monotone timestamps.
Unfortunately this flag is not evaluated in the 
av_interleaved_write_packet() function, which gives me the error described.

Wouldn't it be more correct to evaluate this flag at this time and allow 
the non monotone timestamp if the flag is set?
Is there a certain reason why this flag is simply ignored at this time?

A very bruteforce-solution to this, is to simply set the dts to the 
previously used dts+1 before passing the packet to 
av_interleaved_write_packet(), which prevents the wirte from failing, 
althouh the result is not 100% correct, which can be recognized when 
playing the file again.

Mit freundlichen Gr??en

Philip Spitzlinger

synedra information technologies GmbH
Feldstra?e 1/13
A-6020 Innsbruck

eMail: p.spitzlinger at synedra.com

Fon: +43 /(0)512 / 58 15 05
Fax: +43 /(0)512 / 58 15 05 - 111

Handelsgericht Innsbruck
Firmenbuch: 268961 g

More information about the ffmpeg-devel mailing list