FFmpeg Non-monotonous DTS Warning: Causes and Fixes
The FFmpeg warning "Non-monotonous DTS" (written "Non-monotonic DTS" in FFmpeg 6.1 and later) means that the timestamp of a packet being written was equal to or earlier than the timestamp of the previous packet in the same stream. FFmpeg rewrites that timestamp and continues the conversion, so the file is still created, but the timestamps at the join no longer match the original video. This warning often appears when joining videos with -c copy. I triggered the warning in my test environment, confirmed how to read the numbers, and then tested re-encoding until the warning went away.
The test environment is an Ubuntu 24.04.5 virtual machine with 4 CPU cores and FFmpeg 6.1.1 (Ubuntu package 6.1.1-3ubuntu5). The source material is two 3-second MP4 files made from FFmpeg's test video and audio (640×360, 30 fps, H.264, AAC 48 kHz mono). I triggered the warning by joining the two files with the concat demuxer and -c copy. I did not test other causes of this warning, such as files recorded with interruptions, MPEG-TS joins, or stream recordings. I also did not test the actual output on FFmpeg 6.0 or earlier.
- 1. The warning appeared when I joined two videos with -c copy
- 2. "Non-monotonous" and "Non-monotonic" are the same warning
- 3. How to read the numbers in the message
- 4. The first audio packet started before time 0
- 5. Use -xerror to stop on this warning
- 6. Fix 1: Re-encode only the audio
- 7. Fix 2: Re-encode with the concat filter
The warning appeared when I joined two videos with -c copy
I created the following list (list.txt) and joined the two files with the concat demuxer, without re-encoding.
file 'a.mp4'
file 'b.mp4'
ffmpeg -f concat -i list.txt -c copy out.mp4
During the run, this line appeared. I copied the output as it is. The 0x… at the start is a memory address, which changes on each run.
[mp4 @ 0x55b342648440] Non-monotonic DTS in output stream 0:1; previous: 144384, current: 144000; changing to 144385. This may result in incorrect timestamps in the output file.
The warning appeared only once, and the FFmpeg exit code was 0. I decoded the resulting out.mp4 to the end without any errors. The video was 6.000000 seconds long and the audio was 6.021333 seconds long. The conversion does not fail when this warning appears, so it is easy to miss.
"Non-monotonous" and "Non-monotonic" are the same warning
"Non-monotonous DTS" is the spelling you will find in most search results, and it is used up to FFmpeg 6.0. Comparing the published source code, fftools/ffmpeg_mux.c in 6.0 uses Non-monotonous DTS in output stream, and the same file in 6.1.1 uses Non-monotonic DTS in output stream. The surrounding logic is the same. Either spelling has the same meaning and the same fix. In the 7.1 source, the message is Non-monotonic DTS; previous: …, with the in output stream 0:1 part removed.
How to read the numbers in the message
DTS (Decoding Time Stamp) is the time at which a packet is decoded. When writing to MP4, the DTS within a stream must keep increasing. avformat.h in FFmpeg says that the DTS of packets passed to the muxer (the part that writes the file) must increase strictly. Only formats with the AVFMT_TS_NONSTRICT flag may stay the same, as long as the value does not decrease.
The parts of the message mean the following.
| Part | Meaning |
|---|---|
output stream 0:1 |
The second stream (1) of the first output file (0). In this example, this is the audio. |
previous: 144384 |
The DTS of the packet written just before. |
current: 144000 |
The DTS of the packet FFmpeg is trying to write now. It is smaller than the previous value. |
changing to 144385 |
The DTS after FFmpeg rewrote it (the previous value plus 1). |
The unit is the time base of that stream (the length of one tick). The audio uses 1/48000 seconds, so 144384 is 3.008 seconds and 144000 is 3.000 seconds. In other words, the first audio packet of the second file had a timestamp 0.008 seconds earlier than the last audio packet of the first file.

When I wrote to Matroska (MKV) using the same join, I got this output.
[matroska @ 0x564a1e3ee440] Non-monotonic DTS in output stream 0:1; previous: 3008, current: 3000; changing to 3008. This may result in incorrect timestamps in the output file.
The Matroska time base is 1/1000 seconds, so the numbers are 3008 and 3000. The rewritten value was 3008, the same as the previous value. The Matroska muxer source sets AVFMT_TS_NONSTRICT, so the same DTS is allowed to repeat. MP4 output does not set this flag, so FFmpeg uses the previous value plus 1.
In the 6.1.1 source, when the rewrite of an audio packet is 2 ticks or less, FFmpeg writes a debug log instead of a warning, so it does not appear in normal output. Video still produces a warning even when the difference is small.
The first audio packet started before time 0
For this material, ffprobe showed that both the video and the audio were 3.000000 seconds long. However, AAC audio is stored in packets of 1024 samples each. Three seconds is 144000 samples, which is not divisible by 1024, so the last packet used only 640 samples. The first packet also started at time -1024.
packet|pts=-1024|dts=-1024|duration=1024|
packet|pts=0|dts=0|duration=1024
...
packet|pts=142336|dts=142336|duration=1024
packet|pts=143360|dts=143360|duration=640
The concat demuxer documentation says that timestamps in the next file are adjusted so that the file starts where the previous one ends, and that this adjustment is applied to all streams together, not per stream. If I shift the second file by 3 seconds (144000), the first packet of that file, which starts at -1024, becomes 142976. That is 384 samples before the last packet of the first file, which is at 143360 in input time.
Also, unless you specify otherwise, ffmpeg shifts the whole output so that the first input timestamp (here -1024) becomes 0. As a result, at output time, 143360 becomes 144384 and 142976 becomes 144000, which matches the numbers in the warning. In fact, the first audio packet in out.mp4 had timestamp 0. When I used -copyts, which keeps input timestamps unshifted, and joined the files the same way, the numbers in the warning also stayed at the input timestamps.
[mp4 @ 0x55aaf2239980] Non-monotonic DTS in output stream 0:1; previous: 143360, current: 142976; changing to 143361. This may result in incorrect timestamps in the output file.
In both cases, the difference is 384 samples (0.008 seconds). For the reason the lengths differ, the concat filter documentation notes that the lengths of video and audio are not always exactly the same, because of codec frame sizes and similar factors.
When I checked the packets written to out.mp4 after the warning, FFmpeg's rewrite was still there. The last packet of the first file was only 1 sample long, and the first packet of the second file started at 144385.
packet|pts=143360|dts=143360|duration=1024
packet|pts=144384|dts=144384|duration=1
packet|pts=144385|dts=144385|duration=639
packet|pts=145024|dts=145024|duration=1024
Use -xerror to stop on this warning
Because the conversion usually succeeds anyway, you may miss this warning when creating videos in a script. When I added -xerror (stop with an error and exit), the conversion stopped at the same point.
ffmpeg -xerror -f concat -i list.txt -c copy x.mp4
This is the part of the output after the warning.
[mp4 @ 0x559378be1940] Non-monotonic DTS in output stream 0:1; previous: 144384, current: 144000; Error muxing a packet
[out#0/mp4 @ 0x559378b02480] video:305kB audio:26kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 1.391625%
size= 335kB time=00:00:03.10 bitrate= 883.9kbits/s speed= 437x
Conversion failed!
The exit code was 234, and x.mp4 remained as a file containing only the first input (about 3.09 seconds).
Even when -xerror stops the conversion, the output file is not deleted and remains on disk. In scripts, check whether ffmpeg succeeded by its exit code, not by whether the output file exists.
Fix 1: Re-encode only the audio
The problem is at the audio join, so I kept the video as -c copy and re-encoded only the audio.
ffmpeg -f concat -i list.txt -c:v copy -c:a aac fix-audio.mp4
No warnings or errors appeared, and the exit code was 0. The run took 0.15 seconds. The resulting file decoded without errors. The video was 6.000000 seconds long and the audio was 6.029333 seconds long. The out.mp4 that produced the warning had one audio packet that was only 1 sample long, but this file had none.
This method fixes the problem without reducing video quality, so it is the first one to try.
Fix 2: Re-encode with the concat filter
If you can re-encode both video and audio, join the files with the concat filter. According to the concat filter documentation, for each video except the last, the concat filter matches the length of the longest stream, and fills missing audio with silence.
ffmpeg -i a.mp4 -i b.mp4 -filter_complex "[0:v][0:a][1:v][1:a]concat=n=2:v=1:a=1[v][a]" -map "[v]" -map "[a]" -c:v libx264 -c:a aac fix-filter.mp4
This also produced no warnings or errors, and the exit code was 0. The video was 6.000000 seconds long and the audio was 6.016000 seconds long. There were no audio packets that were only 1 sample long. The run took 0.57 seconds. Because the video was also re-encoded, it took longer than the audio-only fix (0.15 seconds).
If you do not want to change the video quality, the audio-only re-encoding method is the better choice. If you can re-encode the video too and want the video and audio lengths matched at each join, use the concat filter.




