I am using ffmpeg concat demuxer to join multiple(189) videos together. The videos are originally split from a single video using the following command:

ffmpeg -ss time[2] -vsync 1 -copyts -i inputfile.mp4 -ss time[0] -to time[1] -c:a copy -c:v libx264 -b:v 800k output.mp4

Thereafter I am using the following concat command:

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

The problem is that the sum of the lengths of the input videos is 24:03:520 The output.mp4 video comes out to be 24:05:550. Which is two seconds longer than the constituent video length.

I need the output video to be time accurate. How can I achieve this without reencoding the video?

1 Answer 1


In my experience -safe 0 with a file with relative paths sometimes messes up the concat command, adding time, in my case, over an hour.

The other thing is that the files might have different timebases.

Check them and make sure they are the same. Premiere for me output the same files using the same codec and compressdifferent timebases.

  • Tried it. This does not work. All the cut files have identical timebases. It still adds a lot of time after removing -safe 0
    – Shreyas
    Commented Nov 28, 2023 at 12:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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