Lossless concatenation of slightly different MP4 files I am trying to combine 2 or more .mp4 videos into a single video (concatenation). But I am getting timestamps errors (with ffmpeg concat demuxer protocol). The videos are very similar (same resolution, fps, etc.), so I'm not sure what is causing this. I am open to trying different tools (hopefully something that runs on linux).

Apparently they are slightly different in some way.

How can I concatenate them, without losing quality?

If you need more information please tell me what command I should run to print the required details.

Update: I am trying to concatenate 4 files. I am using the command:

ffmpeg -f concat -i list.txt -c copy full.mp4


where list.txt is a text file with the contents:

file 1.mp4
file 2.mp4
file 3.mp4
file 4.mp4


By request I executed the same command with -report as added as the first option. This produced a large log file (110 MB) that you can see here: http://www.filedropper.com/ffmpeg-20180606-024711.

I also ran ffprobe on each file, and uploaded the results here:


ffprobe 1.mp4: https://justpaste.it/64pih
ffprobe 2.mp4: https://justpaste.it/6r4ig
ffprobe 3.mp4: https://justpaste.it/77iij
ffprobe 4.mp4: https://justpaste.it/3xdoi
Your 2nd file is different. You can re-encode it this way,

ffmpeg -i 2.mp4 -map 0:a -map 0:v
       -c:v libx264 -profile:v main -c:a aac -ar 48000 
       -video_track_timescale 2500   2-new.mp4


Depending on how the video in the other files was encoded, you may need to try adding -bf 1 or -bf 0.