VideoHelp Forum
+ Reply to Thread
Results 1 to 16 of 16
Thread
  1. Member
    Join Date
    Oct 2018
    Location
    United States
    Search PM
    So I'm trying to concatenate 5 video files. I'm running Linux, and the command line looks like this:

    Code:
    ffmpeg -f concat -safe 0 -i blist.txt -c copy output.mp4
    blist.txt contains this:

    Code:
    file '00 - Test Pattern.mp4'
    file '01 - In Memoriam.mp4'
    file 'Feature Presentation 01.mp4'
    file 'The Head.mp4'
    file 'Intermission 03.mp4'
    Soon as it starts processing the second file, it throws errors like this, but continues running:

    Code:
    [mp4 @ 0x1c4c4c0] Non-monotonous DTS in output stream 0:1; previous: 274141424, current: 253439430; changing to 274141425. This may result in incorrect timestamps in the output file.
    The resulting video plays perfectly, up until the end of the 4th video. The 5th video has video, but no audio. Last run I did on this, with the same files, had audio but no video, just a black screen.

    I know I need to re-encode all the files, but I have no idea what parameters to use, and nobody seems willing to tell me.

    Can someone please help me with this? I'm going bald from pulling my hair out over this. 3 days now, and the majority of places I've tried, I either get told "paste the incredibly long log so we can ignore you" or they just ignore me. I'm at my wits end over this.
    Image Attached Files
    Quote Quote  
  2. Member
    Join Date
    Aug 2013
    Location
    Central Germany
    Search PM
    "Non-monotonous Display Time Stamp" means that a later segment in the concat list does not continue the time stamps from the end of the first segment. That may make seeking in the result unreliable. Therefore, ffmpeg started to fix it by rewriting time stamps.

    A warning is not an error. If it were an error, ffmpeg would have aborted.

    Regarding the missing video or audio ... that needs someone with more experience than me.
    Quote Quote  
  3. If the video and audio formats match, why don't you join your files using mkvtoolnix-gui?
    Quote Quote  
  4. Member
    Join Date
    Oct 2018
    Location
    United States
    Search PM
    Because I'm limited to console only. Headless machine, no X server, no gui.
    Quote Quote  
  5. mkvtoolnix-gui is actually using mkvmerge which has no gui. It's part of the same package.
    Quote Quote  
  6. Member
    Join Date
    Oct 2018
    Location
    United States
    Search PM
    So I just tried mkvmerge... Interesting, but no cigar:

    Code:
        charlie@workshop:/mnt/media$ mkvmerge -o "upload/upload.mp4" "upload/00 - Test Pattern.mp4" +"upload/01 - In Memoriam.mp4" +"upload/Feature Presentation 01.mp4" +"upload/Intermission 03.mp4"
        mkvmerge v8.8.0 ('Wind at my back') 64bit
        'upload/00 - Test Pattern.mp4': Using the demultiplexer for the format 'QuickTime/MP4'.
        'upload/01 - In Memoriam.mp4': Using the demultiplexer for the format 'QuickTime/MP4'.
        'upload/Feature Presentation 01.mp4': Using the demultiplexer for the format 'QuickTime/MP4'.
        'upload/Intermission 03.mp4': Using the demultiplexer for the format 'QuickTime/MP4'.
        'upload/00 - Test Pattern.mp4' track 0: Using the output module for the format 'AVC/h.264'.
        'upload/00 - Test Pattern.mp4' track 1: Using the output module for the format 'AAC'.
        'upload/01 - In Memoriam.mp4' track 0: Using the output module for the format 'AVC/h.264'.
        'upload/01 - In Memoriam.mp4' track 1: Using the output module for the format 'AAC'.
        'upload/Feature Presentation 01.mp4' track 0: Using the output module for the format 'AVC/h.264'.
        'upload/Feature Presentation 01.mp4' track 1: Using the output module for the format 'AAC'.
        'upload/Intermission 03.mp4' track 0: Using the output module for the format 'AVC/h.264'.
        'upload/Intermission 03.mp4' track 1: Using the output module for the format 'AAC'.
        No append mapping was given for the file no. 1 ('upload/01 - In Memoriam.mp4'). A default mapping of 1:0:0:0,1:1:0:1 will be used instead. Please keep that in mind if mkvmerge aborts with an error message regarding invalid '--append-to' options.
        No append mapping was given for the file no. 2 ('upload/Feature Presentation 01.mp4'). A default mapping of 2:0:1:0,2:1:1:1 will be used instead. Please keep that in mind if mkvmerge aborts with an error message regarding invalid '--append-to' options.
        No append mapping was given for the file no. 3 ('upload/Intermission 03.mp4'). A default mapping of 3:0:2:0,3:1:2:1 will be used instead. Please keep that in mind if mkvmerge aborts with an error message regarding invalid '--append-to' options.
        Error: The track number 1 from the file 'upload/Intermission 03.mp4' cannot be appended to the track number 1 from the file 'upload/Feature Presentation 01.mp4'. The track parameters do not match.
    Quote Quote  
  7. I was going to say use some linux NLE since you've decided to re-encode , just drop them on a timeline - done. But that might be hard running headless

    What are the video characteristics of each video ? Use ffprobe or mediainfo
    Quote Quote  
  8. Member
    Join Date
    Oct 2018
    Location
    United States
    Search PM
    Here's the data using ffprobe:

    Code:
        charlie@workshop:/mnt/media$ /usr/local/bin/ffmpeg -i "upload/00 - Test Pattern.mp4"
        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
        	  
        charlie@workshop:/mnt/media$ /usr/local/bin/ffmpeg -i "upload/01 - In Memoriam.mp4"
        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/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 #0: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 #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 128 kb/s (default)
            Metadata:
              handler_name    : SoundHandler
        	  
        charlie@workshop:/mnt/media$ /usr/local/bin/ffmpeg -i "upload/99 - End Loop.mp4"
        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/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 #0: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 #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 128 kb/s (default)
            Metadata:
              handler_name    : SoundHandler
    Quote Quote  
  9. Are you missing a couple ? Why only 3 ?

    upload/00 - Test Pattern.mp4
    upload/01 - In Memoriam.mp4
    upload/99 - End Loop.mp4


    file '00 - Test Pattern.mp4'
    file '01 - In Memoriam.mp4'
    file 'Feature Presentation 01.mp4'
    file 'The Head.mp4'
    file 'Intermission 03.mp4'



    1) You can try manually demuxing them to elementary streams , then appending video & audio segments separately, but you might still have problems and potential desync . This would be preferred because if it works, you avoid re-encoding and quality loss

    2) Higher chance of success is decoding to some I-frame format (uncompressed or lossless compression) and uncompressed PCM audio, append, then re-encode to your final format . This is essentially the same thing as using a NLE which decodes on the timeline.
    Quote Quote  
  10. Member
    Join Date
    Oct 2018
    Location
    United States
    Search PM
    So we have a working solution!

    Some kind soul took pity of me over on Reddit, and walked me through converting to .mkv format from the original .mp4 format. And the files link up beautifully now!

    Keep lurking!
    Quote Quote  
  11. Originally Posted by cwinthrop View Post
    So I'm trying to concatenate 5 video files. I'm running Linux, and the command line looks like this:

    Code:
    ffmpeg -f concat -safe 0 -i blist.txt -c copy output.mp4
    Notepad++ Malwarebytes FileZilla
    blist.txt contains this:

    Code:
    file '00 - Test Pattern.mp4'
    file '01 - In Memoriam.mp4'
    file 'Feature Presentation 01.mp4'
    file 'The Head.mp4'
    file 'Intermission 03.mp4'
    Soon as it starts processing the second file, it throws errors like this, but continues running:

    Code:
    [mp4 @ 0x1c4c4c0] Non-monotonous DTS in output stream 0:1; previous: 274141424, current: 253439430; changing to 274141425. This may result in incorrect timestamps in the output file.
    The resulting video plays perfectly, up until the end of the 4th video. The 5th video has video, but no audio. Last run I did on this, with the same files, had audio but no video, just a black screen.

    I know I need to re-encode all the files, but I have no idea what parameters to use, and nobody seems willing to tell me.

    Can someone please help me with this? I'm going bald from pulling my hair out over this. 3 days now, and the majority of places I've tried, I either get told "paste the incredibly long log so we can ignore you" or they just ignore me. I'm at my wits end over this.
    I would state utilize some linux NLE since you've chosen to re-encode , simply drop them on a course of events - done. In any case, that may be hard running headless
    Last edited by pauloctavio; 4th Oct 2018 at 15:09.
    Quote Quote  
  12. Member
    Join Date
    Dec 2018
    Location
    Vietnam
    Search PM
    Originally Posted by cwinthrop View Post
    So we have a working solution!

    Some kind soul took pity of me over on Reddit, and walked me through converting to .mkv format from the original .mp4 format. And the files link up beautifully now!

    Keep lurking!
    Hello. I'm running into the same problem as you and I need your solution. Could you be so kind to post it here or PM me how you solve it. Thanks in advanced
    Quote Quote  
  13. Hello. I'm running into the same problem as you and I need your solution. Could you be so kind to post it here or PM me how you solve it. Thanks in advanced
    I had a similar issue a few years ago, trying to concatenate three parts of a TV recording in MP4, a temporary conversion to TS format did the trick.
    Code:
    ffmpeg -i input1.mp4 -c copy -bsf h264_mp4toannexb temp1.ts
    ffmpeg -i input2.mp4 -c copy -bsf h264_mp4toannexb temp2.ts
    ffmpeg -i input3.mp4 -c copy -bsf h264_mp4toannexb temp3.ts
    ffmpeg -i "concat:temp1.ts|temp2.ts|temp3.ts" -c copy -absf aac_adtstoasc output.mp4
    I don't remember what the “-bsf h264_mp4toannexb” means though, and find no mention of it in the integrated help.
    Or you can use MKVToolNix as suggested above, with the “append” feature.
    Quote Quote  
  14. Originally Posted by abolibibelot View Post
    Hello. I'm running into the same problem as you and I need your solution. Could you be so kind to post it here or PM me how you solve it. Thanks in advanced
    I had a similar issue a few years ago, trying to concatenate three parts of a TV recording in MP4, a temporary conversion to TS format did the trick.
    Code:
    ffmpeg -i input1.mp4 -c copy -bsf h264_mp4toannexb temp1.ts
    ffmpeg -i input2.mp4 -c copy -bsf h264_mp4toannexb temp2.ts
    ffmpeg -i input3.mp4 -c copy -bsf h264_mp4toannexb temp3.ts
    ffmpeg -i "concat:temp1.ts|temp2.ts|temp3.ts" -c copy -absf aac_adtstoasc output.mp4
    I don't remember what the “-bsf h264_mp4toannexb” means though, and find no mention of it in the integrated help.
    Or you can use MKVToolNix as suggested above, with the “append” feature.
    Life saver! I've registered here just to try and express my gratitude to you!

    I would be very thankful if someone'd described to me what exactly "-bsf h264_mp4toannexb" command does though, just for the sake of knowledge.
    Quote Quote  
  15. I would be very thankful if someone'd described to me what exactly "-bsf h264_mp4toannexb" command does though, just for the sake of knowledge.
    See https://stackoverflow.com/questions/32028437/what-are-bitstream-filters-in-ffmpeg, I think it offers a good explanation.
    users currently on my ignore list: deadrats, Stears555
    Quote Quote  
  16. Originally Posted by Selur View Post
    I would be very thankful if someone'd described to me what exactly "-bsf h264_mp4toannexb" command does though, just for the sake of knowledge.
    See https://stackoverflow.com/questions/32028437/what-are-bitstream-filters-in-ffmpeg, I think it offers a good explanation.
    Thanks a lot!
    Quote Quote  



Similar Threads

Visit our sponsor! Try DVDFab and backup Blu-rays!