Software⏱️ 4 min read📅 2026-06-11

How to Fix: ffmpeg: Buffer queue overflow error appears when adding audio with amix to overlay filtered video

FFmpeg buffer queue overflow error occurs when combining multiple videos with audio using the overlay filter and amix. Solution involves adjusting audio delay settings to prevent buffer queue overflow.

Quick Answer: Adjust audio delay settings to prevent buffer queue overflow, such as setting adelay=0 for all input streams.

The buffer queue overflow error in ffmpeg occurs when adding audio with amix to overlay filtered video. This issue affects users who want to combine multiple video files at different start times using the overlay filter, and adds an additional layer of complexity by including audio.

This error can be frustrating for those trying to achieve seamless video playback with synchronized audio. In this guide, we will explore the root causes of this error and provide two primary fix methods to resolve the issue.

💡 Why You Are Getting This Error

  • The buffer queue overflow error is caused by the amix filter not being able to handle the combined audio streams from multiple sources efficiently. When adding audio with amix to overlay filtered video, ffmpeg tries to process all the audio streams simultaneously, leading to a buffer queue overflow.
  • Another reason for this error is that the setpts and asetpts filters are used incorrectly in the filter complex. These filters are used to synchronize the video playback with the audio, but if not used correctly, they can cause the audio to be delayed or out of sync with the video.

🔧 Proven Troubleshooting Steps

Adjusting Amix Filter Settings

  1. Step 1: To fix this issue, adjust the amix filter settings to ensure that all audio streams are processed efficiently. This can be done by adding the 'afmtshow' option to the amix filter, which specifies the audio format of each input stream.
  2. Step 2: For example, add the following options to the amix filter: afmtshow=1:0:a:stereo,afmtshow=2:0:a:stereo. This will ensure that both audio streams are processed in stereo format.
  3. Step 3: Additionally, adjust the 'adelay' values for each audio stream to match the desired audio delay. For example, add the following options: adelay=2000|2000 for the first audio stream and adelay=3000|3000 for the second audio stream.

Reordering Filter Complex

  1. Step 1: Another solution is to reorder the filter complex to ensure that the setpts and asetpts filters are used correctly. This can be done by moving the setpts and asetpts filters before the overlay filters.
  2. Step 2: For example, change the filter complex to: [1:v] setpts=PTS-STARTPTS+2/TB [v1]; [0:v] [v1] overlay=x=50:y='if( gte(t,2), H-(t-2)*128, NAN)' [o1]; [2:v] asetpts=PTS-STARTPTS+3/TB,scale=width=320:height=240 [v2]; [o1] [v2] overlay=x=100:y='if( gte(t,3), H-(t-3)*102.4, NAN)' [outv]; [1:a] adelay=2000|2000 [a1]; [2:a] adelay=3000|3000 [a2]; [0:a] [a1] [a2] amix=inputs=3:duration=longest [outa].

✨ Wrapping Up

By adjusting the amix filter settings or reordering the filter complex, you can resolve the buffer queue overflow error in ffmpeg and achieve seamless video playback with synchronized audio. Remember to test your configuration thoroughly to ensure that all audio streams are processed efficiently.

Did this fix your problem?

If not, try searching for specific error codes.

🔍 Search Error Database

❓ Frequently Asked Questions