Answers.Body: <p>Your 2nd file is different. You can re-encode it this way,</p>
  
  <pre><code>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
  </code></pre>
  
  <p>Depending on how the video in the other files was encoded, you may need to try adding <code>-bf 1</code> or <code>-bf 0</code>.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-06-07T06:31:30.530Z
Answers.Text: Thanks. The resulting file is almost half-the size (and smaller than what I expect from similar files of similar duration). Is this lossless?
Answers.UserDisplayName: a06e
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-06-07T06:38:22.330Z
Answers.Text: It uses CRF 23 as default encoding. Add `-crf 18` for visually lossless result
Answers.UserDisplayName: Gyan
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-06-07T05:55:46.703Z
Answers.LastActivityDate: 2018-06-07T05:55:46.703Z
Answers.UserDisplayName: Gyan
Body: <p>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).</p>
  
  <p>Apparently they are slightly different in some way.</p>
  
  <p>How can I concatenate them, without losing quality?</p>
  
  <p>If you need more information please tell me what command I should run to print the required details.</p>
  
  <p><strong>Update:</strong> I am trying to concatenate 4 files. I am using the command:</p>
  
  <pre><code>ffmpeg -f concat -i list.txt -c copy full.mp4
  </code></pre>
  
  <p>where <code>list.txt</code> is a text file with the contents:</p>
  
  <pre><code>file 1.mp4
  file 2.mp4
  file 3.mp4
  file 4.mp4
  </code></pre>
  
  <p>By request I executed the same command with <code>-report</code> as added as the first option. This produced a large log file (110 MB) that you can see here: <a href="http://www.filedropper.com/ffmpeg-20180606-024711" rel="nofollow noreferrer">http://www.filedropper.com/ffmpeg-20180606-024711</a>.</p>
  
  <p>I also ran <code>ffprobe</code> on each file, and uploaded the results here:</p>
  
  <ol>
  <li><code>ffprobe 1.mp4</code>: <a href="https://justpaste.it/64pih" rel="nofollow noreferrer">https://justpaste.it/64pih</a></li>
  <li><code>ffprobe 2.mp4</code>: <a href="https://justpaste.it/6r4ig" rel="nofollow noreferrer">https://justpaste.it/6r4ig</a></li>
  <li><code>ffprobe 3.mp4</code>: <a href="https://justpaste.it/77iij" rel="nofollow noreferrer">https://justpaste.it/77iij</a></li>
  <li><code>ffprobe 4.mp4</code>: <a href="https://justpaste.it/3xdoi" rel="nofollow noreferrer">https://justpaste.it/3xdoi</a></li>
  </ol>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2018-06-05T06:36:00.710Z
Comments.Text: Run the same command with -report added and share the report file
Comments.UserDisplayName: Gyan
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2018-06-06T00:56:21.863Z
Comments.Text: @Gyan The report file is ~ 110 MB (is that normal?). I uploaded it here http://www.filedropper.com/ffmpeg-20180606-024711.
Comments.UserDisplayName: a06e
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2018-06-06T16:46:06.413Z
Comments.Text: That's too large. Share output of `ffprobe file` and `ffprobe file2` as well as your command.
Comments.UserDisplayName: Gyan
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2018-06-06T21:57:18.743Z
Comments.Text: @Gyan Please see edits in the question. I added the requested information.
Comments.UserDisplayName: a06e
Tags: <mp4>
Title: Lossless concatenation of slightly different MP4 files
UserDisplayName: a06e
ThreadText: # Lossless concatenation of slightly different MP4 files
  
  (Asked by: username_0 on 2018-06-04)
  
  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>
  
  **Tags:** mp4
  
  > **Comments:**
  > **username_1**: Run the same command with -report added and share the report file  
  > **username_0**: @username_1 The report file is ~ 110 MB (is that normal?). I uploaded it here http://www.filedropper.com/ffmpeg-20180606-024711.  
  > **username_1**: That's too large. Share output of `ffprobe file` and `ffprobe file2` as well as your command.  
  > **username_0**: @username_1 Please see edits in the question. I added the requested information.  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2018-06-07. Score: 1 | Accepted answer
  
  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`.
  
  > **Comments:**
  > **username_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?  
  > **username_1**: It uses CRF 23 as default encoding. Add `-crf 18` for visually lossless result  
  
  ---
  
  