-1

I have several video files that I want to merge together, after I speed up a 2 minute section of video (its uninteresting 2 minutes, but sped up it will be ok, and not lose continuity.) When I try to merge the edited file with the others, it fails. Here is an example of the error produced.

[mp4 @ 0x103b180] Non-monotonous DTS in output stream 0:0; previous: 22228547, current: 7750549; changing to 22228548. This may result in incorrect timestamps in the output file.

I get this error when issuing this command:

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

I just issued this:

ffprobe -select_streams a -show_entries stream=time_base -of compact=p=0 newout8.mp4

And the output is below:

Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'newout8.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf56.40.101
  Duration: 00:00:14.68, start: 0.021333, bitrate: 23787 kb/s
    Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuvj420p(pc), 1920x1080 [SAR 1:1 DAR 16:9], 23651 kb/s, 29.97 fps, 29.97 tbr, 29967 tbn, 59.94 tbc (default)
    Metadata:
      handler_name    : VideoHandler
    Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, mono, fltp, 128 kb/s (default)
    Metadata:
      handler_name    : SoundHandler
time_base=1/48000

This is one of the files that I need it to merge(concat) with. I used:

ffprobe -select_streams a -show_entries stream=time_base -of compact=p=0 out7.mp4

Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'out7.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf56.40.101
  Duration: 00:04:07.02, start: 0.000000, bitrate: 30106 kb/s
    Stream #0:0(eng): Video: h264 (High) (avc1 / 0x31637661), yuvj420p(pc, bt709), 1920x1080 [SAR 1:1 DAR 16:9], 29972 kb/s, 29.97 fps, 29.97 tbr, 90k tbn, 59.94 tbc (default)
    Metadata:
      handler_name    : VideoHandler
    Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 128 kb/s (default)
    Metadata:
      handler_name    : SoundHandler
time_base=1/48000

As I understand it, I need to re-encode the short clip (newout8.mp4), then the files will merge nicely. Also, ffmpeg does output a file, but playback doesnt work right.

* New content below *

Here is the full output from trying to concat:

    /New$ ffmpeg -f concat -safe 0 -i mylist.txt -c copy output.mp4ffmpeg version 2.8.11-0ubuntu0.16.04.1 Copyright (c) 2000-2017 the FFmpeg developers
      built with gcc 5.4.0 (Ubuntu 5.4.0-6ubuntu1~16.04.4) 20160609
      configuration: --prefix=/usr --extra-version=0ubuntu0.16.04.1 --build-suffix=-ffmpeg --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --cc=cc --cxx=g++ --enable-gpl --enable-shared --disable-stripping --disable-decoder=libopenjpeg --disable-decoder=libschroedinger --enable-avresample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libmodplug --enable-libmp3lame --enable-libopenjpeg --enable-libopus --enable-libpulse --enable-librtmp --enable-libschroedinger --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxvid --enable-libzvbi --enable-openal --enable-opengl --enable-x11grab --enable-libdc1394 --enable-libiec61883 --enable-libzmq --enable-frei0r --enable-libx264 --enable-libopencv
      libavutil      54. 31.100 / 54. 31.100
      libavcodec     56. 60.100 / 56. 60.100
      libavformat    56. 40.101 / 56. 40.101
      libavdevice    56.  4.100 / 56.  4.100
      libavfilter     5. 40.101 /  5. 40.101
      libavresample   2.  1.  0 /  2.  1.  0
      libswscale      3.  1.101 /  3.  1.101
      libswresample   1.  2.101 /  1.  2.101
      libpostproc    53.  3.100 / 53.  3.100
    [mov,mp4,m4a,3gp,3g2,mj2 @ 0xfda560] Auto-inserting h264_mp4toannexb bitstream filter
    Input #0, concat, from 'mylist.txt':
      Duration: N/A, start: 0.000000, bitrate: 30100 kb/s
        Stream #0:0(eng): Video: h264 (High) (avc1 / 0x31637661), yuvj420p(pc, bt709), 1920x1080 [SAR 1:1 DAR 16:9], 29972 kb/s, 29.97 fps, 29.97 tbr, 90k tbn, 59.94 tbc
        Metadata:
          handler_name    : VideoHandler
        Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 128 kb/s
        Metadata:
          handler_name    : SoundHandler
    File 'output.mp4' already exists. Overwrite ? [y/N] y
    [mp4 @ 0xfe2180] Codec for stream 0 does not use global headers but container format requires global headers
    [mp4 @ 0xfe2180] Codec for stream 1 does not use global headers but container format requires global headers
    Output #0, mp4, to 'output.mp4':
      Metadata:
        encoder         : Lavf56.40.101
        Stream #0:0(eng): Video: h264 ([33][0][0][0] / 0x0021), yuvj420p, 1920x1080 [SAR 1:1 DAR 16:9], q=2-31, 29972 kb/s, 29.97 fps, 29.97 tbr, 90k tbn, 90k tbc
        Metadata:
          handler_name    : VideoHandler
        Stream #0:1(eng): Audio: aac ([64][0][0][0] / 0x0040), 48000 Hz, stereo, 128 kb/s
        Metadata:
          handler_name    : SoundHandler
    Stream mapping:
      Stream #0:0 -> #0:0 (copy)
      Stream #0:1 -> #0:1 (copy)
    Press [q] to stop, [?] for help
    [mov,mp4,m4a,3gp,3g2,mj2 @ 0xfda560] Auto-inserting h264_mp4toannexb bitstream filter 
    [mp4 @ 0xfe2180] Non-monotonous DTS in output stream 0:0; previous: 22228206, current: 7409208; changing to 22228207. This may result in incorrect timestamps in the output file.
    [mp4 @ 0xfe2180] Non-monotonous DTS in output stream 0:0; previous: 22228207, current: 7410209; changing to 22228208. This may result in incorrect timestamps in the output file.
    [mp4 @ 0xfe2180] Non-monotonous DTS in output stream 0:0; previous: 22228208, current: 7411210; changing to 22228209. This may result in incorrect timestamps in the output file.
    [mp4 @ 0xfe2180] Non-monotonous DTS in output stream 0:0; previous: 22228209, current: 7412211; changing to 22228210. This may result in incorrect timestamps in the output file.
    [mp4 @ 0xfe2180] Non-monotonous DTS in output stream 0:0; previous: 22228210, current: 7413212; changing to 22228211. This may result in incorrect timestamps in the output file.
    [mp4 @ 0xfe2180] Non-monotonous DTS in output stream 0:0; previous: 22228211, current: 7414213; changing to 22228212. This may result in incorrect timestamps in the output file.
    [mp4 @ 0xfe2180] Non-monotonous DTS in output stream 0:0; previous: 22228212, current: 7415214; changing to 22228213. This may result in incorrect timestamps in the output file.
    [mp4 @ 0xfe2180] Non-monotonous DTS in output stream 0:0; previous: 22228213, current: 7416215; changing to 22228214. This may result in incorrect timestamps in the output file.
    [mp4 @ 0xfe2180] Non-monotonous DTS in output stream 0:0; previous: 22228214, current: 7417216; changing to 22228215. This may result in incorrect timestamps in the output file.
    [mp4 @ 0xfe2180] Non-monotonous DTS in output stream 0:0; previous: 22228215, current: 7418217; changing to 22228216. This may result in incorrect timestamps in the output file.
    [mp4 @ 0xfe2180] Non-monotonous DTS in output stream 0:0; previous: 22228216, current: 7419218; changing to 22228217. This may result in incorrect timestamps in the output file.
    [mp4 @ 0xfe2180] Non-monotonous DTS in output stream 0:0; previous: 22228217, current: 7420219; changing to 22228218. This may result in incorrect timestamps in the output file.
    [mp4 @ 0xfe2180] Non-monotonous DTS in output stream 0:0; previous: 22228218, current: 7421220; changing to 22228219. This may result in incorrect timestamps in the output file.
    [mp4 @ 0xfe2180] Non-monotonous DTS in output stream 0:0; previous: 22228219, current: 7422221; changing to 22228220. This may result in incorrect timestamps in the output file.
    [mp4 @ 0xfe2180] Non-monotonous DTS in output stream 0:0; previous: 22228220, current: 7423222; changing to 22228221. This may result in incorrect timestamps in the output file.
    [mp4 @ 0xfe2180] Non-monotonous DTS in output stream 0:0; previous: 22228221, current: 7424223; changing to 22228222. This may result in incorrect timestamps in the output file.
    [mp4 @ 0xfe2180] Non-monotonous DTS in output stream 0:0; previous: 22228222, current: 7425224; changing to 22228223. This may result in incorrect timestamps in the output file.
    [mp4 @ 0xfe2180] Non-monotonous DTS in output stream 0:0; previous: 22228223, current: 7426225; changing to 22228224. This may result in incorrect timestamps in the output file.

<<< Cut out many lines of errors because body limit of 30,000 charactors prevented me from posting all 70844 characters. >>


    [mp4 @ 0xfe2180] Non-monotonous DTS in output stream 0:0; previous: 22228555, current: 7758557; changing to 22228556. This may result in incorrect timestamps in the output file.
    [mov,mp4,m4a,3gp,3g2,mj2 @ 0xfda560] Auto-inserting h264_mp4toannexb bitstream filter
    [mp4 @ 0xfe2180] Packet with invalid duration -29667 in stream 0ate=30032.2kbits/s    
    frame= 9451 fps=412 q=-1.0 Lsize= 1157876kB time=00:05:15.70 bitrate=30045.3kbits/s    
    video:1152663kB audio:4933kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.024227%

Here is the contents of mylist.txt

#file './out1.mp4'
#file './out2.mp4'
#file './out4.mp4'
#file './out5.mp4'
#file './out6.mp4'
file './out7.mp4'
file './out8speed3.mp4'
file './out9.mp4'
#file './out10.mp4'

As you see above, Ive shortened the errors by limiting it to merging 3 files 2 unedited, and the edited one in the middle (out8speed3).

I tried to post the whole error message, but it was way too many for the post limit of 30,000 characters (as noted above).

Here is the ffprob for the newly edited (I changed the audio bitrate to 127k, like the other files, after editing the clip by speeding it up from 2 minutes to 15 seconds.)

/New$ ffprobe -select_streams a -show_entries stream=time_base -of compact=p=0 out8speed3.mp4 
ffprobe version 2.8.11-0ubuntu0.16.04.1 Copyright (c) 2007-2017 the FFmpeg developers
  built with gcc 5.4.0 (Ubuntu 5.4.0-6ubuntu1~16.04.4) 20160609
  configuration: --prefix=/usr --extra-version=0ubuntu0.16.04.1 --build-suffix=-ffmpeg --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --cc=cc --cxx=g++ --enable-gpl --enable-shared --disable-stripping --disable-decoder=libopenjpeg --disable-decoder=libschroedinger --enable-avresample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libmodplug --enable-libmp3lame --enable-libopenjpeg --enable-libopus --enable-libpulse --enable-librtmp --enable-libschroedinger --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxvid --enable-libzvbi --enable-openal --enable-opengl --enable-x11grab --enable-libdc1394 --enable-libiec61883 --enable-libzmq --enable-frei0r --enable-libx264 --enable-libopencv
  libavutil      54. 31.100 / 54. 31.100
  libavcodec     56. 60.100 / 56. 60.100
  libavformat    56. 40.101 / 56. 40.101
  libavdevice    56.  4.100 / 56.  4.100
  libavfilter     5. 40.101 /  5. 40.101
  libavresample   2.  1.  0 /  2.  1.  0
  libswscale      3.  1.101 /  3.  1.101
  libswresample   1.  2.101 /  1.  2.101
  libpostproc    53.  3.100 / 53.  3.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'out8speed3.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf56.40.101
  Duration: 00:00:11.68, start: 0.021333, bitrate: 29167 kb/s
    Stream #0:0(eng): Video: h264 (High) (avc1 / 0x31637661), yuvj420p(pc), 1920x1080 [SAR 1:1 DAR 16:9], 29032 kb/s, 29.97 fps, 29.97 tbr, 30k tbn, 59.94 tbc (default)
    Metadata:
      handler_name    : VideoHandler
    Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 128 kb/s (default)
    Metadata:
      handler_name    : SoundHandler
time_base=1/48000

ffprobe output for out7.mp4 was previously listed, below is output for out9.mp4

/New$ ffprobe -select_streams a -show_entries stream=time_base -of compact=p=0 out9.mp4 
ffprobe version 2.8.11-0ubuntu0.16.04.1 Copyright (c) 2007-2017 the FFmpeg developers
  built with gcc 5.4.0 (Ubuntu 5.4.0-6ubuntu1~16.04.4) 20160609
  configuration: --prefix=/usr --extra-version=0ubuntu0.16.04.1 --build-suffix=-ffmpeg --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --cc=cc --cxx=g++ --enable-gpl --enable-shared --disable-stripping --disable-decoder=libopenjpeg --disable-decoder=libschroedinger --enable-avresample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libmodplug --enable-libmp3lame --enable-libopenjpeg --enable-libopus --enable-libpulse --enable-librtmp --enable-libschroedinger --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxvid --enable-libzvbi --enable-openal --enable-opengl --enable-x11grab --enable-libdc1394 --enable-libiec61883 --enable-libzmq --enable-frei0r --enable-libx264 --enable-libopencv
  libavutil      54. 31.100 / 54. 31.100
  libavcodec     56. 60.100 / 56. 60.100
  libavformat    56. 40.101 / 56. 40.101
  libavdevice    56.  4.100 / 56.  4.100
  libavfilter     5. 40.101 /  5. 40.101
  libavresample   2.  1.  0 /  2.  1.  0
  libswscale      3.  1.101 /  3.  1.101
  libswresample   1.  2.101 /  1.  2.101
  libpostproc    53.  3.100 / 53.  3.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'out9.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf56.40.101
  Duration: 00:00:57.00, start: 0.008000, bitrate: 29959 kb/s
    Stream #0:0(eng): Video: h264 (High) (avc1 / 0x31637661), yuvj420p(pc, bt709), 1920x1080 [SAR 1:1 DAR 16:9], 30006 kb/s, 29.97 fps, 29.97 tbr, 90k tbn, 59.94 tbc (default)
    Metadata:
      handler_name    : VideoHandler
    Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 127 kb/s (default)
    Metadata:
      handler_name    : SoundHandler
time_base=1/48000
  • 1
    Hard to make sense of your question. Please don't use comments for this kind of information, rather edit your post and ask one specific question, ideally include the particular command that fails, include the entire command-line output, and provide some sample to reproduce the issue. – slhck Sep 19 '17 at 5:54
  • Thank you for your help. When I originally posted, I was half way through the post when I accidentally posted. I tried to edit, but it said I didnt have that privilege, or it had been too late to edit. Its kind of complicated to distill down to one question, but I will try. Should I just start where it failed, and not post any of the things that I have figured out about why it may have failed? Nearest that I can tell, I will have to start a new post to do that, im pretty sure that editing isnt a valid option for me. – Hippy Nerd Sep 20 '17 at 15:40
  • It let me edit my post. What info should I remove, or add? – Hippy Nerd Sep 20 '17 at 15:55
  • Ive managed to edit my post, and tried to add pertinent info, and formatting to make it (hopefully!) not to hard to read. – Hippy Nerd Sep 20 '17 at 16:20
  • Oh, I almost forgot to add that I re-encoded the clip with 127kbit audio, but that didnt help. – Hippy Nerd Sep 20 '17 at 16:20
0

New$ ffmpeg -i newout8.mp4 -video_track_timescale 90000 -strict -2 newout8speed3.mp4

fixed the file.

I found this here: https://stackoverflow.com/questions/31691943/ffmpeg-concat-poduces-dts-out-of-order-errors

I was able to figure out that they were talking about the tbn value. mine says 90k, not 90000, which made it harder for me to figure out.

It turns out that my video needed to be converted to 90000, just like in the other post.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.