[FFmpeg-user] Concatenate two mp4 videos - result is not playable

Cley Faye cleyfaye at gmail.com
Thu Jan 19 21:19:34 EET 2017


2017-01-19 15:04 GMT+01:00 Maxime Daymard <mdaymard at gmail.com>:

> Command (obviously the concat.txt file must contains the paths to the two
> input videos) :
> ffmpeg -f concat -safe 0 -i concat.txt -c copy -y result.mp4
>
> Both videos can be found on dropbox here (~50M):
> https://www.dropbox.com/sh/v99mngn7pfhrfvx/AADKnnJ1trFEF-kPy6p7dssga?dl=0
>
> Thank you again very much in advance !
>
> PS : First time I ask for help here, not sure if it's the right place, but
> I'm really out of solutions right now :( ..
>

​It's better if you put in your message:
- the whole command
- in this case, the content of concat.txt
- the full uncut output of ffmpeg, including headers

Very often it contains the answer to what have gone wrong.

In your case (concatenating two mp4 files without reencoding) it should
work if both files have the same (or compatible) streams. The exact
restrictions eludes me, but in "simple" cases with the same source it
JustWork™.

But your sources have some differences; I'm not sure which is causing the
issue, but I suspect it's the resolution change:

$ ffprobe video1.mp4
ffprobe version N-82314-g863ebe6 Copyright (c) 2007-2016 the FFmpeg
developers
  built with gcc 5.4.0 (GCC)
  configuration: --enable-gpl --enable-version3 --disable-w32threads
--enable-dxva2 --enable-libmfx --enable-nvenc --enable-avisynth
--enable-bzlib --enable-libebur128 --enable-fontconfig --enable-frei0r
--enable-gnutls --enable-iconv --enable-libass --enable-libbluray
--enable-libbs2b --enable-libcaca --enable-libfreetype --enable-libgme
--enable-libgsm --enable-libilbc --enable-libmodplug --enable-libmp3lame
--enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenh264
--enable-libopenjpeg --enable-libopus --enable-librtmp
--enable-libschroedinger --enable-libsnappy --enable-libsoxr
--enable-libspeex --enable-libtheora --enable-libtwolame
--enable-libvidstab --enable-libvo-amrwbenc --enable-libvorbis
--enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264
--enable-libx265 --enable-libxavs --enable-libxvid --enable-libzimg
--enable-lzma --enable-decklink --enable-zlib
  libavutil      55. 36.100 / 55. 36.100
  libavcodec     57. 66.101 / 57. 66.101
  libavformat    57. 57.100 / 57. 57.100
  libavdevice    57.  2.100 / 57.  2.100
  libavfilter     6. 66.100 /  6. 66.100
  libswscale      4.  3.100 /  4.  3.100
  libswresample   2.  4.100 /  2.  4.100
  libpostproc    54.  2.100 / 54.  2.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'video1.mp4':
  Metadata:
    major_brand     : mp42
    minor_version   : 0
    compatible_brands: isommp42
    creation_time   : 2016-08-17T22:50:35.000000Z
  Duration: 00:00:10.11, start: 0.000000, bitrate: 38018 kb/s
    Stream #0:0(eng): Video: h264 (Baseline) (avc1 / 0x31637661), yuv420p,
1696x848, 37832 kb/s, 29.97 fps, 29.97 tbr, 90k tbn, 180k tbc (default)
    Metadata:
      creation_time   : 2016-08-18T00:02:24.000000Z
      handler_name    : VideoHandle
    Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz,
stereo, fltp, 189 kb/s (default)
    Metadata:
      creation_time   : 2016-08-18T00:02:24.000000Z
      handler_name    : SoundHandle

$ ffprobe​ video2.mp4
​ffprobe version N-82314-g863ebe6 Copyright (c) 2007-2016 the FFmpeg
developers
  built with gcc 5.4.0 (GCC)
  configuration: --enable-gpl --enable-version3 --disable-w32threads
--enable-dxva2 --enable-libmfx --enable-nvenc --enable-avisynth
--enable-bzlib --enable-libebur128 --enable-fontconfig --enable-frei0r
--enable-gnutls --enable-iconv --enable-libass --enable-libbluray
--enable-libbs2b --enable-libcaca --enable-libfreetype --enable-libgme
--enable-libgsm --enable-libilbc --enable-libmodplug --enable-libmp3lame
--enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenh264
--enable-libopenjpeg --enable-libopus --enable-librtmp
--enable-libschroedinger --enable-libsnappy --enable-libsoxr
--enable-libspeex --enable-libtheora --enable-libtwolame
--enable-libvidstab --enable-libvo-amrwbenc --enable-libvorbis
--enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264
--enable-libx265 --enable-libxavs --enable-libxvid --enable-libzimg
--enable-lzma --enable-decklink --enable-zlib
  libavutil      55. 36.100 / 55. 36.100
  libavcodec     57. 66.101 / 57. 66.101
  libavformat    57. 57.100 / 57. 57.100
  libavdevice    57.  2.100 / 57.  2.100
  libavfilter     6. 66.100 /  6. 66.100
  libswscale      4.  3.100 /  4.  3.100
  libswresample   2.  4.100 /  2.  4.100
  libpostproc    54.  2.100 / 54.  2.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'video2.mp4':
  Metadata:
    major_brand     : mp42
    minor_version   : 0
    compatible_brands: mp42mp41
    creation_time   : 2017-01-06T22:30:23.000000Z
  Duration: 00:00:08.19, start: 0.000000, bitrate: 101474 kb/s
    Stream #0:0(eng): Video: h264 (High) (avc1 / 0x31637661), yuv420p(tv,
bt709), 4096x2048 [SAR 1:1 DAR 2:1], 101549 kb/s, 29.97 fps, 29.97 tbr, 30k
tbn, 59.94 tbc (default)
    Metadata:
      creation_time   : 2017-01-06T22:30:23.000000Z
      handler_name    : ?Mainconcept Video Media Handler
      encoder         : AVC Coding
    Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz,
stereo, fltp, 125 kb/s (default)
    Metadata:
      creation_time   : 2017-01-06T22:30:23.000000Z
      handler_name    : #Mainconcept MP4 Sound Media Handler​

​As you can see, the video codec change (the profile is baseline in
video1.mp4, high in video2.mp4) and the resolution is different, among
other things.​

Other with more knowledge on these subjects might weight in, but I doubt
mp4 containers can handle codec and resolution changes on the fly.


More information about the ffmpeg-user mailing list