Answers.Body: <p>Assuming there are no timestamp discontinuities in the audio, a simple atrim and a null segment should work.</p>
  
  <pre><code>ffmpeg -i DFW.mp4.mkv -filter_complex '
  [0:a]asplit[a][b];
  [a]atrim=0:1122.1[pre];
  [b]atrim=1122.1,asetpts=PTS-STARTPTS[post];
  anullsrc,atrim=0:1.1[seg];
  [pre][seg][post]concat=n=3:a=1:v=0[a]' -map 0:v -map '[a]' -c:v copy DFW-1.mp4
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-03-27T16:12:48.527Z
Answers.Text: Ah, so this is how that's done. Cool.
Answers.UserDisplayName: sjngm
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-03-27T16:45:44.463Z
Answers.Text: After inserting five pauses like this ffmpeg starts to complain about "Buffer queue overflow, dropping" again
Answers.UserDisplayName: sjngm
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-03-27T16:49:12.043Z
Answers.Text: What's your new command?
Answers.UserDisplayName: Gyan
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-03-27T17:12:14.667Z
Answers.Text: I use the exact same way like you do. I just change the positions in the `atrim`s.
Answers.UserDisplayName: sjngm
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-03-27T17:29:17.817Z
Answers.Text: As in multiple commands? Or additional filters in single command?
Answers.UserDisplayName: Gyan
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-03-27T18:05:53.000Z
Answers.Text: Well, I took your call and executed it multiple times with different values for the `atrim`s.
Answers.UserDisplayName: sjngm
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-03-27T19:24:40.743Z
Answers.Text: Still not clear. Multiple or single command?
Answers.UserDisplayName: Gyan
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-03-28T05:19:58.773Z
Answers.Text: Again, exactly what you posted in your answer. Anyway, we were told that we will get a full audio stream from a different source and hopefully can apply that to the entire video.
Answers.UserDisplayName: sjngm
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-03-26T17:53:38.837Z
Answers.LastActivityDate: 2017-03-26T17:53:38.837Z
Answers.UserDisplayName: Gyan
Body: <p>I have this video file that at one point introduces an async of ~1 second. So I tried to make it work by duplicating a short segment at that point as it's silent there:</p>
  
  <pre><code>$ ffmpeg -i DFW.mp4.mkv -filter_complex '
  [0:a] aselect=n=3:e=lt(t\,18*60+42.100)+gt(t\,18*60+41)*2 [as] [ae] [am];
  [am] asplit [am1] [am2];
  [as]  asetpts=PTS-STARTPTS [as];
  [am1] asetpts=PTS-STARTPTS [am1];
  [am2] asetpts=PTS-STARTPTS [am2];
  [ae]  asetpts=PTS-STARTPTS [ae];
  [as] [am1] [am2] [ae] concat=n=4:a=1:v=0 [a]' -map 0:v -map '[a]' -c:v copy DFW-1.mp4
  </code></pre>
  
  <p>In other words I have</p>
  
  <ul>
  <li><code>as</code> the start until 18:41.000</li>
  <li><code>ae</code> the end from 18:42.100</li>
  <li><code>am</code> the middle section between 18:41.000 and 18:42.100, which should be repeated once</li>
  </ul>
  
  <p>The segmentation works, the concatenated audible part sounds good. However, <code>ae</code> turns out to only be ~5 seconds short and <code>ffmpeg</code> starts to print spammy "Buffer queue overflow, dropping"-lines. The entire video is 1h30 long leaving me with plenty of silence until the end.</p>
  
  <p>In other words the video and audio are fine until about 18:48.000 and the remaining 1h11 of the video has no audio.</p>
  
  <p>Why is <code>ffmpeg</code> doing that and how can I fix it?</p>
  
  <p><em>I also tried to include a silence audio segment instead as plan B, but failed.</em></p>
  
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2017-03-26T17:05:41.547Z
Comments.Text: A buffer overflow occurs when a filter having multiple inputs is waiting on one or more inputs, which are late. The inputs already queued have a frame drop threshold which is crossed if those inputs are sufficiently late. What's wrong with just adding a blank segment?
Comments.UserDisplayName: Gyan
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2017-03-26T17:20:58.043Z
Comments.Text: @Mulvya Well, I failed creating/using one. It would solve my problem, though. -- But, then again I don't know why ffmpeg stops after five seconds. I'd say either use the entire rest of the stream or nothing at all. However, `ae` is ~5 seconds long, which is weird.
Comments.UserDisplayName: sjngm
Tags: <ffmpeg><filter>
Title: ffmpeg: concat Results in "Buffer queue overflow" and Short Audio
UserDisplayName: sjngm
ThreadText: # ffmpeg: concat Results in "Buffer queue overflow" and Short Audio
  
  (Asked by: username_0 on 2017-03-26)
  
  I have this video file that at one point introduces an async of ~1 second. So I tried to make it work by duplicating a short segment at that point as it's silent there:
  
  ```
  $ ffmpeg -i DFW.mp4.mkv -filter_complex '
  [0:a] aselect=n=3:e=lt(t\,18*60+42.100)+gt(t\,18*60+41)*2 [as] [ae] [am];
  [am] asplit [am1] [am2];
  [as]  asetpts=PTS-STARTPTS [as];
  [am1] asetpts=PTS-STARTPTS [am1];
  [am2] asetpts=PTS-STARTPTS [am2];
  [ae]  asetpts=PTS-STARTPTS [ae];
  [as] [am1] [am2] [ae] concat=n=4:a=1:v=0 [a]' -map 0:v -map '[a]' -c:v copy DFW-1.mp4
  
  ```
  
  In other words I have
  
  * `as` the start until 18:41.000
  * `ae` the end from 18:42.100
  * `am` the middle section between 18:41.000 and 18:42.100, which should be repeated once
  
  The segmentation works, the concatenated audible part sounds good. However, `ae` turns out to only be ~5 seconds short and `ffmpeg` starts to print spammy "Buffer queue overflow, dropping"-lines. The entire video is 1h30 long leaving me with plenty of silence until the end.
  
  In other words the video and audio are fine until about 18:48.000 and the remaining 1h11 of the video has no audio.
  
  Why is `ffmpeg` doing that and how can I fix it?
  
  *I also tried to include a silence audio segment instead as plan B, but failed.*
  
  **Tags:** ffmpeg, filter
  
  > **Comments:**
  > **username_1**: A buffer overflow occurs when a filter having multiple inputs is waiting on one or more inputs, which are late. The inputs already queued have a frame drop threshold which is crossed if those inputs are sufficiently late. What's wrong with just adding a blank segment?  
  > **username_0**: @Mulvya Well, I failed creating/using one. It would solve my problem, though. -- But, then again I don't know why ffmpeg stops after five seconds. I'd say either use the entire rest of the stream or nothing at all. However, `ae` is ~5 seconds long, which is weird.  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2017-03-26. Score: 0 | Accepted answer
  
  Assuming there are no timestamp discontinuities in the audio, a simple atrim and a null segment should work.
  
  ```
  ffmpeg -i DFW.mp4.mkv -filter_complex '
  [0:a]asplit[a][b];
  [a]atrim=0:1122.1[pre];
  [b]atrim=1122.1,asetpts=PTS-STARTPTS[post];
  anullsrc,atrim=0:1.1[seg];
  [pre][seg][post]concat=n=3:a=1:v=0[a]' -map 0:v -map '[a]' -c:v copy DFW-1.mp4
  
  ```
  
  > **Comments:**
  > **username_0**: Ah, so this is how that's done. Cool.  
  > **username_0**: After inserting five pauses like this ffmpeg starts to complain about "Buffer queue overflow, dropping" again  
  > **username_1**: What's your new command?  
  > **username_0**: I use the exact same way like you do. I just change the positions in the `atrim`s.  
  > **username_1**: As in multiple commands? Or additional filters in single command?  
  > **username_0**: Well, I took your call and executed it multiple times with different values for the `atrim`s.  
  > **username_1**: Still not clear. Multiple or single command?  
  > **username_0**: Again, exactly what you posted in your answer. Anyway, we were told that we will get a full audio stream from a different source and hopefully can apply that to the entire video.  
  
  ---
  
  