Multiple frames in a packet
ffmpeger 发布于 2023-08-30

aac编解码程序运行过程中出现了Multiple frames in a packet,字面理解就是一个AVPacket中出现了多个AVFrame,在源码中查找,在decode.c文件中,是解码报的问题,出现在以下函数中

static inline int decode_simple_internal(AVCodecContext *avctx, AVFrame *frame, int64_t *discarded_samples)

 

 if (avctx->codec->type == AVMEDIA_TYPE_AUDIO &&

        !avci->showed_multi_packet_warning &&

        ret >= 0 && ret != pkt->size && !(avctx->codec->capabilities & AV_CODEC_CAP_SUBFRAMES)) {

        av_log(avctx, AV_LOG_WARNING, "Multiple frames in a packet.\n");

        avci->showed_multi_packet_warning = 1;

    }

AV_CODEC_CAP_SUBFRAMES的注释如下:

 Codec can output multiple frames per AVPacket

 Normally demuxers return one frame at a time, demuxers which do not do

 are connected to a parser to split what they return into proper frames.

 This flag is reserved to the very rare category of codecs which have a

 bitstream that cannot be split into frames without timeconsuming

  operations like full decoding. Demuxers carrying such bitstreams thus

 may return multiple frames in a packet. This has many disadvantages like

 prohibiting stream copy in many cases thus it should only be considered

 as a last resort.

编解码器可以为每个AVPacket输出多个帧,通常情况下,解复用器一次返回一帧,而不返回的解复用器,连接到一个解析器,将它们返回的内容拆分为适当的帧。

此标志保留给具有无法分割成帧而不耗费时间的比特流,诸如完全解码之类的操作。因此,携带这种比特流的分离器,可以在一个分组中返回多个帧。这有很多缺点,比如,在许多情况下禁止流复制,因此只应考虑不得已而为之

但问题可能出在ret >= 0 && ret != pkt->size

 

ffmpeger
关注 私信
文章
63
关注
0
粉丝
0