1

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.

  • 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? – Gyan Mar 26 '17 at 17:05
  • @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. – sjngm Mar 26 '17 at 17:20
0

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
  • Ah, so this is how that's done. Cool. – sjngm Mar 27 '17 at 16:12
  • After inserting five pauses like this ffmpeg starts to complain about "Buffer queue overflow, dropping" again – sjngm Mar 27 '17 at 16:45
  • What's your new command? – Gyan Mar 27 '17 at 16:49
  • I use the exact same way like you do. I just change the positions in the atrims. – sjngm Mar 27 '17 at 17:12
  • As in multiple commands? Or additional filters in single command? – Gyan Mar 27 '17 at 17:29

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.