ffmpegconcatenation.mov

Concatenating two.mov files results in identical sized file


I try to concatenate two video files a.mov & b.mov on Win 10 using ffmpeg with the following command:

ffmpeg -safe 0 -f concat -i list.txt -vcodec copy -acodec copy c.mov

There are no errors displayed however when I open the resulting file c it has the same length as file a with the last frame appering to be a frame of b. File a is a longer video, file b are credits (couple of seconds) made with ffmpeg from an image file. Both files have the same aspect ratio, size and framerate.

I try to concatenate two video files a.mov & b.mov on Win 10 using ffmpeg with the following command:

ffmpeg -safe 0 -f concat -i list.txt -vcodec copy -acodec copy c.mov

There are no errors displayed however when I open the resulting file c it has the same length as file a with the last frame appering to be a frame of b. File a is a longer video, file b are credits (couple of seconds) made with ffmpeg from an image file. Both files have the same aspect ratio, size and framerate.

Here the log:

  ffmpeg -n -i a.mov -i b.mov 
    ffmpeg version 4.2.3 Copyright (c) 2000-2020 the FFmpeg developers   built with gcc 9.3.1 (GCC) 20200523  configuration: --enable-gpl --enable-version3 --enable-sdl2
    --enable-fontconfig --enable-gnutls --enable-iconv --enable-libass --enable-libdav1d --enable-libbluray --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libtheora --enable-libtwolame --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libzimg --enable-lzma --enable-zlib --enable-gmp --enable-libvidstab --enable-libvorbis --enable-libvo-amrwbenc --enable-libmysofa --enable-libspeex --enable-libxvid --enable-libaom --enable-libmfx --enable-amf --enable-ffnvcodec --enable-cuvid --enable-d3d11va --enable-nvenc --enable-nvdec --enable-dxva2 --enable-avisynth --enable-libopenmpt   libavutil      56. 31.100 / 56. 31.100   libavcodec     58. 54.100 /
    58. 54.100   libavformat    58. 29.100 / 58. 29.100   libavdevice    58.  8.100 / 58.  8.100   libavfilter     7. 57.100 /  7. 57.100   libswscale      5.  5.100 /  5.  5.100   libswresample   3.  5.100 / 
    3.  5.100   libpostproc    55.  5.100 / 55.  5.100 Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'a.mov':   Metadata:
        major_brand     : qt
        minor_version   : 512
        compatible_brands: qt
        encoder         : Lavf58.62.100   Duration: 00:31:50.04, start: 0.000000, bitrate: 5309 kb/s
        Stream #0:0: Video: h264 (High) (avc1 / 0x31637661), yuv420p, 1920x1080, 4151 kb/s, 29.97 fps, 29.97 tbr, 30k tbn, 59.94 tbc (default)
        Metadata:
          handler_name    : Core Media Video
          encoder         : Lavc58.54.100 libx264
        Stream #0:1: Audio: pcm_s24le (in24 / 0x34326E69), 48000 Hz, mono, s32 (24 bit), 1152 kb/s (default)
        Metadata:
          handler_name    : SoundHandler Input #1, mov,mp4,m4a,3gp,3g2,mj2, from 'b.mov':   Metadata:
        major_brand     : qt
        minor_version   : 512
        compatible_brands: qt
        encoder         : Lavf58.29.100   Duration: 00:00:10.01, start: 0.000000, bitrate: 67 kb/s
        Stream #1:0: Video: h264 (High) (avc1 / 0x31637661), yuv420p, 1920x1080, 64 kb/s, 29.97 fps, 29.97 tbr, 11988 tbn, 59.94 tbc (default)
        Metadata:
          handler_name    : VideoHandler
          encoder         : Lavc58.54.100 libx264

Thank you.


Solution

  • Problems

    Your inputs have some different attributes, but they need to be the same to concatenate:

    To fix it

    1. Re-mux b.mov and add silent audio:

      ffmpeg -i b.mov -f lavfi -i anullsrc=r=48000:cl=mono -c:v copy -c:a pcm_s24le -video_track_timescale 30k -shortest b2.mov
      
    2. Then update list.txt with the new file (b2.mov).

    3. Concatenate:

      ffmpeg -safe 0 -f concat -i list.txt -c copy c.mov
      

    Options