[FFmpeg-user] How to Join Video Files and Add Time Gaps Without Re-encoding

Wu-bin Zhen vvubin at gmail.com
Wed Jul 9 20:31:10 CEST 2014

Hello FFmpeg,

I am trying to join multiple video files with adding time gaps among those
files, without re-encoding.
My goal is to create a complete video file from recorded video segments
based on the exact time.

Those recorded video segments(mkv files with VP8 codec) are not
consecutive, so I need to grab the video file create time and then
calculate the time gap, and add the time gap between two video segments.

I am trying to use the command below to create a time gap video and then
add it between two segments:
ffmpeg -loop 1 -f image2 -i img.png -c:v libvpx -t 30 timegap.mkv

and then use command 'mkvmerge' to merge those segments and the timegap
video file, but I got the error as below:
> $ mkvmerge -o 3333.mkv 111.mkv + 222.mkv
> mkvmerge v7.0.0 ('Where We Going') 64bit built on Jun  9 2014 14:10:01
> '111.mkv': Using the demultiplexer for the format 'Matroska'.
> '222.mkv': Using the demultiplexer for the format 'Matroska'.
> '111.mkv' track 0: Using the output module for the format 'VP8/VP9'.
> '222.mkv' track 0: Using the output module for the format 'VP8/VP9'.
> No append mapping was given for the file no. 1 ('222.mkv'). A default
mapping of 1:0:0:0 will be used instead. Please keep that in mind if
mkvmerge aborts with an error message regarding invalid '--append-to'
> Error: The track number 0 from the file '222.mkv' cannot be appended to
the track number 0 from the file '111.mkv'. The track parameters do not

The problem is that the generation of timegap video file takes pretty long,
and mkvmerge does not work for merging those files. So I wonder if there is
a better and working method just by using ffmpeg command, even without
using mkvmerge.

Any advise will be appreciated.

More information about the ffmpeg-user mailing list