使用FFmpeg拼接视频时遇Buffer queue overflow, dropping错误求助
Fixing FFmpeg "Buffer queue overflow, dropping" Error in Complex Video/Audio Concatenation
Hey there! That buffer overflow error pops up when different parts of your FFmpeg filter graph can't sync up their processing speeds—some branches generate frames/audio faster than others can consume them, leading to dropped data. You're right that fifo fixes this for video, and for audio we have afifo to handle the same queueing issue. Let's adjust your command properly:
Modified FFmpeg Command
ffmpeg -i /tmp/media/import-2020-Aug-19-Wednesday-08-08-26/temp_eba59811-bb5c-4e36-aa7d-b1731e70432c.mp4 \ -i /tmp/media/import-2020-Aug-19-Wednesday-08-08-26/temp_2a6d7907-7cad-4f38-ae82-4b475546d3e0.mp4 \ -i /tmp/media/import-2020-Aug-19-Wednesday-08-08-26/temp_d7371ecb-01df-4199-951f-336fa475998f.mp4 \ -i /tmp/media/import-2020-Aug-19-Wednesday-08-08-26/temp_cc5de0f1-84b4-47bc-b390-45b5f8711914.mp4 \ -i /tmp/media/import-2020-Aug-19-Wednesday-08-08-26/temp_bf796e0d-135f-40fd-ab8e-4780da6973fd.mp4 \ -filter_complex " [0:v]trim=start=0:end=8.032,setpts=PTS-STARTPTS,fifo[clip0]; [1:v]trim=start=2:end=13.047,setpts=PTS-STARTPTS,fifo[clip1]; [2:v]trim=start=2:end=13.558,setpts=PTS-STARTPTS,fifo[clip2]; [3:v]trim=start=2:end=13.186,setpts=PTS-STARTPTS,fifo[clip3]; [4:v]trim=start=2,setpts=PTS-STARTPTS,fifo[clip4]; [0:v]trim=start=9.032:end=10.032,setpts=PTS-STARTPTS,fifo[out0]; [1:v]trim=start=14.047:end=15.047,setpts=PTS-STARTPTS,fifo[out1]; [2:v]trim=start=14.558:end=15.558,setpts=PTS-STARTPTS,fifo[out2]; [3:v]trim=start=14.186:end=15.186,setpts=PTS-STARTPTS,fifo[out3]; [1:v]trim=start=0:end=2,setpts=PTS-STARTPTS,fifo[in1]; [2:v]trim=start=0:end=2,setpts=PTS-STARTPTS,fifo[in2]; [3:v]trim=start=0:end=2,setpts=PTS-STARTPTS,fifo[in3]; [4:v]trim=start=0:end=2,setpts=PTS-STARTPTS,fifo[in4]; [in1]format=pix_fmts=yuva420p,fade=t=in:st=0:d=2:alpha=1,fifo[fadein1]; [in2]format=pix_fmts=yuva420p,fade=t=in:st=0:d=2:alpha=1,fifo[fadein2]; [in3]format=pix_fmts=yuva420p,fade=t=in:st=0:d=2:alpha=1,fifo[fadein3]; [in4]format=pix_fmts=yuva420p,fade=t=in:st=0:d=2:alpha=1,fifo[fadein4]; [out0]format=pix_fmts=yuva420p,fade=t=out:st=0:d=2:alpha=1,fifo[fadeout0]; [out1]format=pix_fmts=yuva420p,fade=t=out:st=0:d=2:alpha=1,fifo[fadeout1]; [out2]format=pix_fmts=yuva420p,fade=t=out:st=0:d=2:alpha=1,fifo[fadeout2]; [out3]format=pix_fmts=yuva420p,fade=t=out:st=0:d=2:alpha=1,fifo[fadeout3]; [fadeout0][fadein1]overlay,fifo[crossfade0]; [fadeout1][fadein2]overlay,fifo[crossfade1]; [fadeout2][fadein3]overlay,fifo[crossfade2]; [fadeout3][fadein4]overlay,fifo[crossfade3]; [clip0][crossfade0][clip1][crossfade1][clip2][crossfade2][clip3][crossfade3][clip4]concat=n=9[output]; [0:a]afifo[a0]; [1:a]afifo[a1]; [2:a]afifo[a2]; [3:a]afifo[a3]; [4:a]afifo[a4]; [a0][a1]acrossfade=d=10:c1=tri:c2=tri,afifo[A1]; [A1][a2]acrossfade=d=10:c1=tri:c2=tri,afifo[A2]; [A2][a3]acrossfade=d=10:c1=tri:c2=tri,afifo[A3]; [A3][a4]acrossfade=d=10:c1=tri:c2=tri[audio]" \ -map "[output]" -map "[audio]" /tmp/media/final/some_filename_587463a2-e3ca-436a-874b-a72e295e46ac.mp4
Key Changes Explained
- Video Streams: Added
fiforight after everysetptsandoverlayoperation. These buffers act as temporary storage, ensuring slower downstream filters don't get swamped by faster upstream processing. Even if you had somefifobefore, adding them at every critical branch point eliminates bottlenecks across the entire filter graph. - Audio Streams: Used
afifo(the audio equivalent offifo) for each input audio stream and after everyacrossfade. Long crossfade durations can easily cause audio queue overflow, so these buffers keep audio sync stable and prevent data drops.
This setup balances the speed of all processing branches, so FFmpeg no longer needs to drop frames/audio to keep up. Your crossfade and concat logic stays intact while fixing the error.
内容的提问来源于stack exchange,提问作者Yevhenii Molodtsov
相关产品推荐
相关产品推荐

