[Libav-user] Hello, I have a question to ask you. When I use the libavcodec library, an exception occurs: 5 frames left in the queue on closing. What is the reason for this problem? How can I fix it?
Guangyu Sun
gsun at roblox.com
Mon Jun 7 19:30:53 EEST 2021
On Sun, Jun 6, 2021 at 9:58 PM aszswaz at 163.com <aszswaz at 163.com> wrote:
> I am using libavcodec to mp3 encoding the pcm recording file collected
> by alsa. Please refer to the attachment for the code. Although the code
> can run successfully, the following error will occur:
>
> [libmp3lame @ 0x5653c7e9b880] 5 frames left in the queue on closing.
>
> I want to ask you a few questions:
>
> 1. What is the reason for this error?
>
It means that there are still 5 frames not being encoded.
The encoder may group a few frames together to encode more efficiently. It
still expects more raw samples.
>
> 2. How does this error affect the mp3 audio?
>
The audio file will miss 5 frames of samples at the end.
>
> 3. How can I solve it?
>
You need to tell the encoder there are no more frames to be sent, by
calling avcodec_send_frame() with a NULL frame at the end. After that, keep
calling avcodec_receive_packet() until EOF is returned.
It is documented in avcodec_send_frame() in avcodec.h.
>
> Here is a detailed information:
>
> computer system: Manjaro x86_64
>
> linux kernel version: Linux 5.12.2-1
>
> ALSA version: Advanced Linux Sound Architecture Driver Version
> k5.12.2-1-MANJARO.
>
> ffmpeg version: ffmpeg version n4.4 Copyright (c) 2000-2021 the FFmpeg
> developers
>
> Thank you for reading my mail.
>
> _______________________________________________
> Libav-user mailing list
> Libav-user at ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/libav-user
>
> To unsubscribe, visit link above, or email
> libav-user-request at ffmpeg.org with subject "unsubscribe".
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://ffmpeg.org/pipermail/libav-user/attachments/20210607/c855c9b0/attachment.htm>
More information about the Libav-user
mailing list