2

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:

  1. ffprobe 1.mp4: https://justpaste.it/64pih
  2. ffprobe 2.mp4: https://justpaste.it/6r4ig
  3. ffprobe 3.mp4: https://justpaste.it/77iij
  4. ffprobe 4.mp4: https://justpaste.it/3xdoi
  • Run the same command with -report added and share the report file – Gyan Jun 5 '18 at 6:36
  • @Gyan The report file is ~ 110 MB (is that normal?). I uploaded it here filedropper.com/ffmpeg-20180606-024711. – becko Jun 6 '18 at 0:56
  • That's too large. Share output of ffprobe file and ffprobe file2 as well as your command. – Gyan Jun 6 '18 at 16:46
  • @Gyan Please see edits in the question. I added the requested information. – becko Jun 6 '18 at 21:57
1

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.

  • Thanks. The resulting file is almost half-the size (and smaller than what I expect from similar files of similar duration). Is this lossless? – becko Jun 7 '18 at 6:31
  • 1
    It uses CRF 23 as default encoding. Add -crf 18 for visually lossless result – Gyan Jun 7 '18 at 6:38

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.