On Sun, Jun 6, 2021 at 9:58 PM [email protected] <[email protected]> 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
> [email protected]
> https://ffmpeg.org/mailman/listinfo/libav-user
>
> To unsubscribe, visit link above, or email
> [email protected] with subject "unsubscribe".
>
_______________________________________________
Libav-user mailing list
[email protected]
https://ffmpeg.org/mailman/listinfo/libav-user

To unsubscribe, visit link above, or email
[email protected] with subject "unsubscribe".

Reply via email to