[FFmpeg-devel] [PATCH] libvorbis encoder: fix non monotone timestamp problem

Michael Niedermayer michaelni
Tue Oct 14 22:19:38 CEST 2008

On Mon, Oct 13, 2008 at 07:34:41PM +0200, Nicolas George wrote:
> Hi.
> Sometimes, the libvorbis encoder dies with a "non monotone timestamps"
> problem. For example, with SVN revision 15614 configured with
> "--enable-libvorbis --enable-debug", the following command line:
> sox -t raw -s2 -c 2 -r 44100 /dev/zero -t wav - trim 0 10 synth 440 |
> ./ffmpeg_g-orig -f wav -i - -acodec libvorbis -y /tmp/out.ogg
> (sox produces a 10-seconds WAV file with a 440 Hz sine)
> ffmpeg dies with:
> [libvorbis @ 0xdd5d80]error, non monotone timestamps 440960 >= 440960
> av_interleaved_write_frame(): Error while opening file
> (the rest of the output is just regular stuff, version and streams
> identification; I can copy-paste it here, but there is really nothing
> useful)
> Furthermore, if the output format requires processing at the end, it is not
> done; AVI index, for example, is not built.
> The problem is that at the end of the stream libavcodec calls
> vorbis_analysis_wrote repeatedly with a 0 size. The libvorbisenc
> documentation is rather terse about it, but it seems that this should be
> done only once: otherwise, this causes libvorbisenc to output the last
> packet a second time, with the same granulepos, causing the timestamp
> problem.
> The fix seems obvious: add a flag to avoid calling vorbis_analysis_wrote
> twice with an empty buffer.
> The attached patch does that. The second one fixes the indentation. They do
> not break the regression tests.

patch ok if someone can reproduce the bug and confirm that this fixes it

Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

The educated differ from the uneducated as much as the living from the
dead. -- Aristotle 
-------------- 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/20081014/99a34827/attachment.pgp>

More information about the ffmpeg-devel mailing list