Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

In order to make quality tests, I would like to compress the audio part (to a low bitrate) of a matroska file without damaging video. Audio codec is AAC and video codec is H264. I am using avconv on Ubuntu. When I launch the CLI:

 avconv -i input.mkv -f matroska -vcodec copy -acodec copy -ab 12k \
            -strict experimental output.mkv

I get the error:

[matroska @ 0x1ea79c0] Application provided invalid, non monotonically increasing dts to muxer in stream 0: -80 >= -80 av_interleaved_write_frame(): Invalid argument

It doesn't occur when I use .mp4 files (if I the CLI in consequence).

The full output is as follow:

[matroska,webm @ 0x971960] Estimating duration from bitrate, this may be inaccurate
Input #0, matroska,webm, from 'Arte-Documentaire-2013-06-07-13-35-30-269s-x264.mkv':
  Duration: 00:05:00.44, start: 0.000000, bitrate: N/A
    Stream #0.0(eng): Video: h264 (Main), yuv420p, 1920x1080 [PAR 1:1 DAR 16:9], 25 fps, 25 tbr, 1k tbn, 180k tbc (default)
    Stream #0.1(eng): Audio: aac, 48000 Hz, stereo, s16 (default)
File 'out.mkv' already exists. Overwrite ? [y/N] y
Output #0, matroska, to 'out.mkv':
    encoder         : Lavf53.21.1
    Stream #0.0(eng): Video: H264 / 0x34363248, yuv420p, 1920x1080 [PAR 1:1 DAR 16:9], q=2-31, 1k tbn, 1k tbc (default)
    Stream #0.1(eng): Audio: aac, 48000 Hz, stereo, s16, 12 kb/s (default)
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
  Stream #0:1 -> #0:1 (aac -> aac)
Press ctrl-c to stop encoding
[matroska @ 0x11e1880] Application provided invalid, non monotonically increasing dts to muxer in stream 0: -80 >= -80
av_interleaved_write_frame(): Invalid argument

Any idea?

share|improve this question
up vote 1 down vote accepted

You cannot copy the audio codec -acodec copy and re-encode it at the same time.

Try the following:

avconv -i input.mkv -c:v copy -c:a aac -strict experimental -b:a 12k out.mkv

Note that the aac encoder in FFmpeg/Libav does not deliver as good quality as others (e.g. libfdk-aac or libfaac).

If that does not work… what versions of the tools are you using? Please always include the full, uncut console output when asking about FFmpeg/Libav.

Does this bug persist when you download the latest version of ffmpeg? Hundreds of bugs are fixed in every release, and chances are you're using an outdated version.

share|improve this answer
I tried your proposal but I still get the same error. When I try the others codec, I get a new error: "unknown encoder". My version of avconv (avconv -version) is: avconv version 0.8.6-6:0.8.6-0 I got it using the classic CLI "sudo apt-get install avconv" – MarAja Jun 26 '13 at 13:46
Could you please try with a newer version, like one from FFmpeg in the link I gave you? – slhck Jun 26 '13 at 14:01
It works! Thanks! Sorry for not having done it the first time :). Nevertheless, I still get unknown encoder when I try to use libfdk-aac or libfaac. If they are better, I would like to work with them. How can I add them? – MarAja Jun 26 '13 at 14:28
Glad it worked. See AAC encoding guide – you'd have to compile ffmpeg with support for those (see also Compilation Guides). – slhck Jun 26 '13 at 14:30

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .