Fixing FFmpeg’s “Too many packets buffered” Error
If FFmpeg prints "Too many packets buffered for output stream 0:0." while converting a video to MP4 or a similar format, run it again with a larger -max_muxing_queue_size value and the error goes away. The error appears when FFmpeg cannot buffer enough packets before it starts writing the output file. For example, this happens when a video's audio starts partway through, you copy the video (-c:v copy), and you encode the audio to AAC for an MP4 file.
In my test environment, I reproduced this error with a video whose audio starts at 35 seconds. I confirmed that the error goes away when I fix it, and that the file written with the error is missing frames.
The test environment was Ubuntu 24.04.5 with FFmpeg 6.1.1 (Ubuntu package 6.1.1-3ubuntu5). The source was a 1280×720, 30fps, 40-second video generated with lavfi's testsrc2 and sine. The video was H.264 and the audio was FLAC. The error occurred only with a file whose audio starts partway through, when the video was copied and the audio encoded to AAC. I did not test files with subtitle or data streams, or other FFmpeg versions.
The message from the failed run
I used late.mkv, a video that runs from 0 to 40 seconds with audio starting at 35 seconds. I made the video with a lossless setting (-qp 0), so its bitrate is about 16 Mbps.
I copied the video as-is, encoded only the audio to AAC, and wrote an MP4 file.
ffmpeg -i late.mkv -c:v copy -c:a aac out.mp4
Right after the Stream mapping output, the following pair of lines repeated 38 times. I have omitted the lines from the third pair onward.
Stream mapping:
Stream #0:0 -> #0:0 (copy)
Stream #0:1 -> #0:1 (flac (native) -> aac (native))
[vost#0:0/copy @ 0x…] Too many packets buffered for output stream 0:0.
[vost#0:0/copy @ 0x…] Error submitting a packet to the muxer
[vost#0:0/copy @ 0x…] Too many packets buffered for output stream 0:0.
[vost#0:0/copy @ 0x…] Error submitting a packet to the muxer
@ 0x… replaces a memory address that changes on every run. According to the FFmpeg stream numbering description, 0:0 refers to the first stream of the first output file. In this case, that is the copied video.
FFmpeg keeps going after the error
FFmpeg did not stop. It did not print Conversion failed!, the exit code was 0, and out.mp4 was created.
However, when I counted the packets in the file, the video packets dropped from 1200 in the source to 1162 in the output.
ffprobe -v error -count_packets -show_entries stream=index,codec_type,nb_read_packets -of compact=p=0 out.mp4
index=0|codec_type=video|nb_read_packets=1162
index=1|codec_type=audio|nb_read_packets=236
The 38 missing packets match the number of error messages. When I sorted the video packets by timestamp, the sequence jumped from 34.1 seconds to 35.4 seconds, and the frames in between were gone.

When I extracted the frame at 35.5 seconds, the picture in the output with the error was broken, and the timestamp in the top-left corner still read in the 34-second range. Even so, decoding the whole file with ffmpeg -v error -i out.mp4 -f null - printed no errors. This gap was not detected by the method for checking whether a video file is corrupt by decoding it all the way through.
If you only check the exit code in batch processing and similar setups, you cannot notice a file with missing frames. Check the FFmpeg log for "Too many packets buffered".
Why packets accumulate
According to the FFmpeg documentation for -max_muxing_queue_size, when FFmpeg encodes audio or video, it does not start writing the output file until each stream being encoded has produced at least one packet. Packets from other streams that arrive in the meantime are buffered. -max_muxing_queue_size sets the maximum number of these buffered packets.
In late.mkv, the audio packets that get encoded to AAC do not arrive until 35 seconds. Meanwhile, the copied video packets keep accumulating. The video packets up to 35 seconds numbered 1050, totaling about 71 MB.
However, the packet limit only takes effect after the buffered data exceeds a certain size. According to the documentation for -muxing_queue_data_threshold, that size defaults to 50 MB per stream.
To confirm this, I changed one condition at a time and ran the same command.
| Input | Video up to 35 s | Errors | Output video packets |
|---|---|---|---|
| late.mkv (about 16 Mbps, audio starts at 35 s) | 1050 packets, about 71 MB | 38 | 1162 |
Same video encoded with -crf 23 (about 3 Mbps, audio starts at 35 s) |
1050 packets, about 13 MB | None | 1200 |
| Same video as late.mkv, audio present from 0 s | ― | None | 1200 |
With the low-bitrate video, the same 1050 packets accumulated, but the data stayed under 50 MB, so no error was printed. When the audio is present from the start, FFmpeg can begin writing right away, so there is no error even at a high bitrate. The error occurs when one stream has to wait and the data buffered during that wait is large.
Fixing it by raising -max_muxing_queue_size
I ran the same conversion again with -max_muxing_queue_size set to a value. FFmpeg options apply to the file that comes after them, so I put the option before the output filename.
ffmpeg -i late.mkv -c:v copy -c:a aac -max_muxing_queue_size 2048 fixed.mp4
These are the results for different values.
-max_muxing_queue_size |
Errors | Output video packets |
|---|---|---|
| 512 | 38 | 1162 |
| 1024 | 38 | 1162 |
| 1050 | 12 | 1188 |
| 1061 | 1 | 1199 |
| 1062 | None | 1200 |
| 1100 | None | 1200 |
| 2048 | None | 1200 |
| 9999 | None | 1200 |
The error count stayed at 38 up to 1024, dropped to 12 at 1050 and to 1 at 1061, and disappeared from 1062 upward. At that point all 1200 video packets were present.
When I decoded the file made with 2048 using -v error, it reported no errors. I also used the framemd5 output format to compute an MD5 for each video packet and compared them with late.mkv. All of them matched. The out.mp4 with the error did not match.
Estimating the value you need
A lower bound for the video case can be estimated as "seconds to wait × frame rate". To find the wait time, use ffprobe to print the timestamp of the first packet in the stream that starts late.
ffprobe -v error -select_streams a -read_intervals "%+#1" -show_entries packet=pts_time -of csv=p=0 late.mkv
35.000000
In late.mkv, the audio starts at 35 seconds and the video is 30 fps, so 35 × 30 = 1050. However, as the table above shows, 1050 is not enough, and the error only went away from 1062. Choose a value with some margin above the calculated number. For this sample, values of 2048 and 9999, both above the calculated 1050, produced all 1200 video packets in the output.
The official documentation also says the default is usually sufficient, so change it only when you find that you need to.
Other fixes
Raising -muxing_queue_data_threshold also made the error go away. The data buffered up to 35 seconds in late.mkv is about 71 MB, so I set it to 200 MB.
ffmpeg -i late.mkv -c:v copy -c:a aac -muxing_queue_data_threshold 200M thr.mp4
No error was printed, and all 1200 video packets were present.
If you can copy the audio instead of encoding it, FFmpeg never has to wait for an encoder. I wrote to MKV with -c copy. No error was printed, the video had 1200 packets, and the audio had 53 packets, the same as the source.
ffmpeg -i late.mkv -c copy copy.mkv
When you need to encode, such as when putting AAC audio into MP4, use -max_muxing_queue_size to fix the error.





