Answers.Body: <p>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.</p>
  <p>The other thing is that the files might have different timebases.</p>
  <p>Check them and make sure they are the same. Premiere for me output the same files using the same codec and compressdifferent timebases.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2023-11-28T12:10:23.020Z
Answers.Text: Tried it. This does not work. All the cut files have identical timebases. 
  It still adds a lot of time after removing -safe 0
Answers.UserDisplayName: Shreyas
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2023-11-27T09:41:04.723Z
Answers.LastActivityDate: 2023-11-27T09:41:04.723Z
Answers.UserDisplayName: Jovi Juan
Body: <p>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:</p>
  <pre><code>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
  </code></pre>
  <p>Thereafter I am using the following concat command:</p>
  <pre><code>ffmpeg -f concat -safe 0 -i list.txt -c copy output.mp4
  </code></pre>
  <p>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 <strong>two seconds longer</strong> than the constituent video length.</p>
  <p>I need the output video to be time accurate. How can I achieve this without reencoding the video?</p>
  
Tags: <ffmpeg><video><concatenation>
Title: FFMPEG Concat Demuxer adds more time to output than expected
UserDisplayName: Shreyas
ThreadText: # FFMPEG Concat Demuxer adds more time to output than expected
  
  (Asked by: username_0 on 2023-09-06)
  
  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?
  
  **Tags:** ffmpeg, video, concatenation
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2023-11-27. Score: 0
  
  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.
  
  > **Comments:**
  > **username_0**: Tried it. This does not work. All the cut files have identical timebases.  It still adds a lot of time after removing -safe 0  
  
  ---
  
  