I have a few videos I want to concatenate into one file.

I can do that following the instructions here: https://superuser.com/a/1059261/3189

However, this puts the videos 'back to back'. I want to insert a gap between the videos and have each video start on a new second (e.g 2:00 not 2:01).

Someone had the same problem for audio (FFmpeg - Concenating audio files with spacing), and a solution was to create a blank audio file and insert it between the tracks.

However, this does not work for my problem as I need each track to start on a rounded second.



You need a 2-Step process for each clip, plus some preparation

Preparation: Create 1s silent black video by using /dev/zero as input with exactly same codec settings as the clips

Per Video (assuming video is 34.56 secs long):

Write concat file /path/to/temp.ffconcat

file '/path/to/clip.mp4'
file '/path/to/blacksilence.mp4'


ffmpeg -f concat -i /path/to/temp.ffconcat -c copy -to 35 /path/to/fullsecond-clip.mp4

Now your Video is prolonged to a round second - repeat this with all clips and you can just play them out one after the other.

  • Using the color source filter is better than /dev/zero because it works on all platforms. – llogan Nov 23 '16 at 20:21
  • How do I make the silent black video with the same codec setting? I've googled to no avail. – jedierikb Nov 23 '16 at 20:31
  • @LordNeckbeard Thanks - I didn't know this one. Anything similar for the sound? – Eugen Rieck Nov 24 '16 at 8:04
  • @jedierikb Post the detailed parameters with which you create your videos and I can up an example for you. – Eugen Rieck Nov 24 '16 at 8:05
  • @EugenRieck Yes, anullsrc or aevalsrc. – llogan Nov 24 '16 at 18:11

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.