[FFmpeg-user] Concatenation of two file does not work correctly

Cecil Westerhof Cecil at decebal.nl
Thu Sep 6 17:39:20 EEST 2018


I have two mov files I want to concatenate.

The first:
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'pauline.mov':
  Metadata:
    major_brand     : qt  
    minor_version   : 512
    compatible_brands: qt  
    encoder         : Lavf57.56.101
  Duration: 00:00:40.09, start: 0.000000, bitrate: 5149 kb/s
    Stream #0:0(eng): Video: h264 (High) (avc1 / 0x31637661), yuvj420p(pc), 1920x1080, 3609 kb/s, 25 fps, 25 tbr, 12800 tbn, 50 tbc (default)
    Metadata:
      handler_name    : DataHandler
      encoder         : Lavc57.64.101 libx264
    Stream #0:1(eng): Audio: pcm_s16le (sowt / 0x74776F73), 48000 Hz, stereo, s16, 1536 kb/s (default)
    Metadata:
      handler_name    : DataHandler

The second:
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'cecil.mov':
  Metadata:
    major_brand     : qt  
    minor_version   : 512
    compatible_brands: qt  
    encoder         : Lavf57.56.101
  Duration: 00:00:12.08, start: 0.000000, bitrate: 5577 kb/s
    Stream #0:0(eng): Video: h264 (High) (avc1 / 0x31637661), yuvj420p(pc), 1920x1080, 4044 kb/s, 25 fps, 25 tbr, 12800 tbn, 50 tbc (default)
    Metadata:
      handler_name    : DataHandler
      encoder         : Lavc57.64.101 libx264
    Stream #0:1(eng): Audio: pcm_s16le (sowt / 0x74776F73), 48000 Hz, stereo, s16, 1536 kb/s (default)
    Metadata:
      handler_name    : DataHandler

I created a publiciteit.txt with:
file pauline.mov
file cecil.mov

And then I call:
ffmpeg -f concat -i publiciteit.txt -acodec copy -vcodec copy publiciteit.mov

This gives:
mov,mp4,m4a,3gp,3g2,mj2 @ 0x5614a3e930e0] Auto-inserting h264_mp4toannexb bitstream filter
Input #0, concat, from 'publiciteit.txt':
  Duration: N/A, start: -0.037333, bitrate: 5145 kb/s
    Stream #0:0(eng): Video: h264 (High) (avc1 / 0x31637661), yuvj420p(pc), 1920x1080, 3609 kb/s, 25 fps, 25 tbr, 12800 tbn, 50 tbc
    Metadata:
      handler_name    : DataHandler
      encoder         : Lavc57.64.101 libx264
    Stream #0:1(eng): Audio: pcm_s16le (sowt / 0x74776F73), 48000 Hz, stereo, s16, 1536 kb/s
    Metadata:
      handler_name    : DataHandler
File 'publiciteit.mov' already exists. Overwrite ? [y/N] y
Output #0, mov, to 'publiciteit.mov':
  Metadata:
    encoder         : Lavf57.56.101
    Stream #0:0(eng): Video: h264 (High) (avc1 / 0x31637661), yuvj420p(pc), 1920x1080, q=2-31, 3609 kb/s, 25 fps, 25 tbr, 12800 tbn, 12800 tbc
    Metadata:
      handler_name    : DataHandler
      encoder         : Lavc57.64.101 libx264
    Stream #0:1(eng): Audio: pcm_s16le (sowt / 0x74776F73), 48000 Hz, stereo, 1536 kb/s
    Metadata:
      handler_name    : DataHandler
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 @ 0x5614a3e930e0] Auto-inserting h264_mp4toannexb bitstream filter
frame= 1054 fps=0.0 q=-1.0 Lsize=   27031kB time=00:00:52.11 bitrate=4249.2kbits/s speed= 458x    
video:19123kB audio:7884kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.090874%

De size of the original files are 25.8 MB and 8.4 MB. The size of the
generated file is 27.7 MB. Which seems a bit small.

After the first part of the generated file has been played, I hear the
sound of the second video, but the screen displays the end of the
first video for 12 seconds and then the video of the second is shown
and the audio is way out of sink. And after the audio is finished the
last 12 seconds of the video are shown without audio.

What could be happening here and how do I solve it.

My version:
ffmpeg version 3.2.12-1~deb9u1 Copyright (c) 2000-2018 the FFmpeg developers
  built with gcc 6.3.0 (Debian 6.3.0-18+deb9u1) 20170516
  configuration: --prefix=/usr --extra-version='1~deb9u1' --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --enable-gpl --disable-stripping --enable-avresample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libebur128 --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libmp3lame --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librubberband --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-libzmq --enable-libzvbi --enable-omx --enable-openal --enable-opengl --enable-sdl2 --enable-libdc1394 --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libopencv --enable-libx264 --enable-shared
  libavutil      55. 34.101 / 55. 34.101
  libavcodec     57. 64.101 / 57. 64.101
  libavformat    57. 56.101 / 57. 56.101
  libavdevice    57.  1.100 / 57.  1.100
  libavfilter     6. 65.100 /  6. 65.100
  libavresample   3.  1.  0 /  3.  1.  0
  libswscale      4.  2.100 /  4.  2.100
  libswresample   2.  3.100 /  2.  3.100
  libpostproc    54.  1.100 / 54.  1.100

-- 
Cecil Westerhof
Senior Software Engineer
LinkedIn: http://www.linkedin.com/in/cecilwesterhof


More information about the ffmpeg-user mailing list