0

I have an original H.264/AVC video created by my phone:

$ ffprobe -hide_banner -i vid1.mp4
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'vid1.mp4':
  Metadata:
    major_brand     : mp42
    minor_version   : 0
    compatible_brands: isommp42
    creation_time   : 2020-10-27T19:43:55.000000Z
    location        : +42.5418-122.5700/
    location-eng    : +42.5418-122.5700/
    com.android.version: 7.1.2
  Duration: 00:00:52.40, start: 0.000000, bitrate: 10187 kb/s
    Stream #0:0(eng): Video: h264 (Baseline) (avc1 / 0x31637661), yuv420p(tv, bt709/bt709/smpte170m), 1280x720, 10002 kb/s, SAR 1:1 DAR 16:9, 30 fps, 30 tbr, 90k tbn, 180k tbc (default)
    Metadata:
      creation_time   : 2020-10-27T19:43:55.000000Z
      handler_name    : VideoHandle
    Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 128 kb/s (default)
    Metadata:
      creation_time   : 2020-10-27T19:43:55.000000Z
      handler_name    : SoundHandle

I have another compatible video encoded with FFmpeg to be concatenated:

$ ffprobe -hide_banner -i vid2.mp4
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'vid2.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf58.29.100
  Duration: 00:00:08.70, start: 0.000000, bitrate: 2732 kb/s
    Stream #0:0(eng): Video: h264 (Constrained Baseline) (avc1 / 0x31637661), yuv420p, 1280x720 [SAR 1:1 DAR 16:9], 2596 kb/s, 30 fps, 30 tbr, 90k tbn, 60 tbc (default)
    Metadata:
      handler_name    : VideoHandle
    Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 128 kb/s (default)
    Metadata:
      handler_name    : SoundHandle

Concatenating with FFmpeg outputs a working video:

$ for v in vid1.mp4 vid2.mp4; do echo "file '${v}'"; done > vids.txt
$ ffmpeg -f concat -i vids.txt -c copy concatenated-ffmpeg.mkv

However, using Avidemux or MKVToolNix to concatenate, results in the second part of the video not displaying correctly. What can I change in the FFmpeg encoded video (vid2.mp4) that would allow me to concatenate with Avidemux & MKVToolNix, as I prefer to use one of those for non-re-encoding jobs?

This is the ffplay output:

Input #0, matroska,webm, from 'concatenated-avidemux.mkv':    0KB sq=    0B f=0/0
  Metadata:
    ENCODER         : Lavf58.20.100
  Duration: 00:01:01.07, start: 0.000000, bitrate: 9080 kb/s
    Stream #0:0: Video: h264 (Baseline), yuv420p(tv, bt709/bt709/smpte170m, progressive), 1280x720, SAR 1:1 DAR 16:9, 30 fps, 30 tbr, 1k tbn, 2k tbc (default)
    Metadata:
      DURATION        : 00:01:01.067000000
    Stream #0:1: Audio: aac (LC), 48000 Hz, stereo, fltp (default)
    Metadata:
      DURATION        : 00:01:01.050000000
[h264 @ 000001436f70a3c0] top block unavailable for requested intra mode -1
[h264 @ 000001436f70a3c0] error while decoding MB 0 0
[h264 @ 000001436f70a3c0] concealing 3600 DC, 3600 AC, 3600 MV errors in I frame
[h264 @ 000001436f70ac80] top block unavailable for requested intra mode -1
[h264 @ 000001436f70ac80] error while decoding MB 1 0
[h264 @ 000001436f70ac80] concealing 3600 DC, 3600 AC, 3600 MV errors in P frame
[h264 @ 0000014376e28240] mb_type 64 in P slice too large at 4 00
[h264 @ 0000014376e28240] error while decoding MB 4 0
[h264 @ 0000014376e28240] concealing 3600 DC, 3600 AC, 3600 MV errors in P frame
[h264 @ 0000014376e286c0] negative number of zero coeffs at 8 2/0
[h264 @ 0000014376e286c0] error while decoding MB 8 2
...
...

Edit (2020-11-07 1:20 UTC):

ffprobe details of concatenated videos:

$ ffprobe -hide_banner -i concatenated-ffmpeg.mkv
Input #0, matroska,webm, from 'concatenated-ffmpeg.mkv':
  Metadata:
    ENCODER         : Lavf58.29.100
  Duration: 00:01:01.10, start: 0.000000, bitrate: 9076 kb/s
    Stream #0:0(eng): Video: h264 (Baseline), yuv420p(tv, bt709/bt709/smpte170m, progressive), 1280x720, SAR 1:1 DAR 16:9, 30 fps, 30 tbr, 1k tbn, 2k tbc (default)
    Metadata:
      HANDLER_NAME    : VideoHandle
      DURATION        : 00:01:01.095000000
    Stream #0:1(eng): Audio: aac (LC), 48000 Hz, stereo, fltp (default)
    Metadata:
      HANDLER_NAME    : SoundHandle
      DURATION        : 00:01:01.077000000

$ ffprobe -hide_banner -i concatenated-avidemux.mkv
Input #0, matroska,webm, from 'concatenated-avidemux.mkv':
  Metadata:
    ENCODER         : Lavf58.20.100
  Duration: 00:01:01.07, start: 0.000000, bitrate: 9080 kb/s
    Stream #0:0: Video: h264 (Baseline), yuv420p(tv, bt709/bt709/smpte170m, progressive), 1280x720, SAR 1:1 DAR 16:9, 30 fps, 30 tbr, 1k tbn, 2k tbc (default)
    Metadata:
      DURATION        : 00:01:01.067000000
    Stream #0:1: Audio: aac (LC), 48000 Hz, stereo, fltp (default)
    Metadata:
      DURATION        : 00:01:01.050000000

Your Answer

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

Browse other questions tagged or ask your own question.