Software⏱️ 3 min read📅 2026-06-15

How to Fix: ffmpeg gives error DTS out of order and Non-monotonous DTS in output stream

FFmpeg concatenation error with DTS out of order and non-monotonous. Solution involves re-encoding audio.

Quick Answer: Use -c:v copy and -c:a libfaac to re-encode audio, then concatenate files.

FFmpeg concatenation error: DTS out of order and non-monotonous DTS in output stream

This issue affects users trying to concatenate multiple MP4 videos into one using ffmpeg, resulting in audio-only or corrupted video files.

💡 Why You Are Getting This Error

  • The primary cause of this error is the use of the `-c copy` option with concat demuxer. This option tells ffmpeg not to reencode the input file, but it can lead to issues when concatenating multiple files with different audio and video codecs.
  • Another potential cause is the incorrect ordering of files in the input.txt file. If the files are not ordered chronologically, ffmpeg may get confused about the correct order of events.

🛠️ Step-by-Step Verified Fixes

Reorder files and use -c:v copy

  1. Step 1: Sort the input files in chronological order based on their timestamps.
  2. Step 2: Modify the concat file to reflect the new ordering (e.g., `file '/raw/01 - Introduction.mp4'` becomes `file '/raw/02 - Background Material.mp4' ... file '/raw/01 - Introduction.mp4'`).
  3. Step 3: Run ffmpeg with the `-c:v copy` option to reencode only the video, while keeping the audio intact.

Use -async 1 and -reconnect 1

  1. Step 1: Add the `-async 1` option to force ffmpeg to wait for the previous stream to finish before starting the next one.
  2. Step 2: Add the `-reconnect 1` option to tell ffmpeg to reconnect any dropped packets.

🎯 Final Words

To resolve this issue, try reordering your input files and using the `-c:v copy` option. Alternatively, you can use the `async` and `reconnect` options. If you're still experiencing issues, refer to the official ffmpeg documentation for more information on concat demuxer settings.

Did this fix your problem?

If not, try searching for specific error codes.

🔍 Search Error Database

❓ Frequently Asked Questions