ffmpeg throwing "Non-monotonous DTS in output stream"

1

So I'm trying to concatenate 3 video files. I'm running Linux, and the command line looks like this:

ffmpeg -f concat -safe 0 -i blist.txt -c copy output.mp4

blist.txt contains this:

file 'btest/00 - Test Pattern.mp4'
file 'btest/01 - In Memoriam.mp4'
file 'btest/EndLoop.mp4'

Soon as it starts processing the second file, it throws errors like this, but continues running:

Non-monotonous DTS in output stream 0:0;

The resulting file should be 4:13 long, but ends up being 9:57 long. First clip plays perfectly, but after that, it's all black screen with the right audio for the remaining 4:13, then silence.

I know I need to re-encode all the files, but I have no idea what parameters to use.

Details about each input and ffmpeg:

ffmpeg version N-92086-gd702769 Copyright (c) 2000-2018 the FFmpeg developers
  built with gcc 5.4.0 (Ubuntu 5.4.0-6ubuntu1~16.04.10) 20160609
  configuration: --disable-x86asm
  libavutil      56. 19.101 / 56. 19.101
  libavcodec     58. 31.102 / 58. 31.102
  libavformat    58. 18.103 / 58. 18.103
  libavdevice    58.  4.105 / 58.  4.105
  libavfilter     7. 33.100 /  7. 33.100
  libswscale      5.  2.100 /  5.  2.100
  libswresample   3.  2.100 /  3.  2.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'upload/00 - Test Pattern.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf56.40.101
  Duration: 00:02:26.87, start: 0.000000, bitrate: 243 kb/s
    Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 1280x720 [SAR 1:1 DAR 16:9], 106 kb/s, 29.97 fps, 29.97 tbr, 30k tbn, 59.94 tbc (default)
    Metadata:
      handler_name    : VideoHandler
    Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 128 kb/s (default)
    Metadata:
      handler_name    : SoundHandler
Input #1, mov,mp4,m4a,3gp,3g2,mj2, from 'upload/01 - In Memoriam.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf56.40.101
  Duration: 00:01:32.07, start: 0.000000, bitrate: 219 kb/s
    Stream #1:0(eng): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 1280x720 [SAR 1:1 DAR 16:9], 82 kb/s, 29.97 fps, 29.97 tbr, 30k tbn, 59.94 tbc (default)
    Metadata:
      handler_name    : VideoHandler
    Stream #1:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 128 kb/s (default)
    Metadata:
      handler_name    : SoundHandler
Input #2, mov,mp4,m4a,3gp,3g2,mj2, from 'upload/99 - End Loop.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf56.40.101
  Duration: 00:00:15.05, start: 0.000000, bitrate: 236 kb/s
    Stream #2:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 1280x720 [SAR 1:1 DAR 16:9], 99 kb/s, 29.97 fps, 29.97 tbr, 30k tbn, 59.94 tbc (default)
    Metadata:
      handler_name    : VideoHandler
    Stream #2:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 128 kb/s (default)
    Metadata:
      handler_name    : SoundHandler
At least one output file must be specified

Can someone please help me with this?

cwinthrop

Posted 2018-09-30T13:44:01.537

Reputation: 11

Does it have to be mp4 or could you perhaps use mkv? You need to keep in mind that you can’t always concatenate audio/video streams. – Daniel B – 2018-09-30T14:40:18.967

It doesn't have to be, but it would be ideal. – cwinthrop – 2018-09-30T15:09:51.790

Show the complete output of ffmpeg -i "00 - Test Pattern.mp4" -i "01 - In Memoriam.mp4" -i "EndLoop.mp4" – llogan – 2018-09-30T17:48:14.537

@LordNeckbeard It's too long to paste here. https://paste.ee/p/d7QEr

– cwinthrop – 2018-09-30T22:16:16.120

What player are you using? How did you create the files? Looking at the console output I don't see anything obviously wrong, maybe I missed something, but perhaps if you provide a link to the input files I can take a closer look. – llogan – 2018-10-01T19:56:35.157

Problem was just fixed about 15 minutes ago by converting the files to .mkv using this command:

ffmpeg -i "input/$t.mp4" -c:a copy -c:v copy "output/$o.mkv" – cwinthrop – 2018-10-01T20:26:32.810

Answers

0

Long story short, after much trial and failure, someone was kind enough to walk me through changing the format from .mp4 to .mkv, which works beautifully.

The exact command used was:

    ffmpeg -i "input/$t.mp4" -c:a copy -c:v copy "output/$o.mkv"

cwinthrop

Posted 2018-09-30T13:44:01.537

Reputation: 11