[FFmpeg-devel] [PATCH] libavcodec: use 64bit counter in deprecated audio encoder API to prevent problems regarding negative dts

Peter Große bugs at friiks.de
Thu Jul 4 19:02:21 CEST 2013


We are using the the libavformat consumer of melt (http://www.mltframework.org)
for RTMP livestream encoding. After several hours a warning occurs in the
libavformat muxer and the encoding crashes:

 [aac @ 0x26f76c0] Que input is backward in time
 [flv @ 0x26d9580] Application provided invalid, non monotonically increasing
 dts to muxer in stream 1: 48695751 >= -48695774

The dts counter seems to count milliseconds, since the problem occurs
reproducible after 13h32m.

While debugging the issue we noticed melt uses the old avcodec_encode_audio
API, which is deprecated for over a year now. The commit [1] introducing the
compatibility API adds a 32 bit integer "sample_count" to AVCodecInternal
(libavcodec/internal.h) used for computing the pts (64bit).

We think that causes the problem, since changing the counter type to int64_t
fixes the problem for us. See patch attached.

For debugging purposes a 15h silent audio track was generated using ffmpeg
with /dev/zero as input.

This patch is also attached to a bug report I created:

Kind regards
Peter Große

-------------- next part --------------
A non-text attachment was scrubbed...
Name: ffmpeg-1.2.1-64bit-samplecount.patch
Type: text/x-patch
Size: 498 bytes
Desc: not available
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20130704/a3eb5721/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20130704/a3eb5721/attachment.asc>

More information about the ffmpeg-devel mailing list