FFmpeg non-existing PPS 0 referenced问题描述
生活随笔
收集整理的這篇文章主要介紹了
FFmpeg non-existing PPS 0 referenced问题描述
小編覺(jué)得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.
查看所有的函數(shù)引用
1)static int h264_slice_header_parse(const H264Context *h, H264SliceContext *sl, const H2645NAL *nal)
??? if (!h->ps.pps_list[sl->pps_id]) {
??????? av_log(h->avctx, AV_LOG_ERROR,
?????????????? "non-existing PPS %u referenced\n",
?????????????? sl->pps_id);
??????? return AVERROR_INVALIDDATA;
??? }
2)static inline int parse_nal_units(AVCodecParserContext *s, AVCodecContext *avctx, const uint8_t * const buf, int buf_size)
??????????? if (!p->ps.pps_list[pps_id]) {
??????????????? av_log(avctx, AV_LOG_ERROR,
?????????????????????? "non-existing PPS %u referenced\n", pps_id);
??????????????? goto fail;
??????????? }
avcodec_send_packet函數(shù)返回-1094995529錯(cuò)誤,根據(jù)FFmpeg的錯(cuò)誤信息,得知為AVERROR_INVALIDDATA,猜測(cè)是第一種情況
在調(diào)用h264_slice_header_parse函數(shù)的時(shí)候,出現(xiàn)了錯(cuò)誤,無(wú)法定位PPS
函數(shù)的調(diào)用邏輯
static int decode_nal_units(H264Context *h, const uint8_t *buf, int buf_size)
?? ?int ff_h264_queue_decode_slice(H264Context *h, const H2645NAL *nal)
?? ??? ?static int h264_slice_header_parse(const H264Context *h, H264SliceContext *sl, const H2645NAL *nal)
結(jié)構(gòu)體的獲取
H264Context* pH264Context = AVCodecContext->priv_data
H264SliceContext *sl = H264Context->slice_ctx + H264Context->nb_slice_ctx_queued;
網(wǎng)上提供了一些方案,暫時(shí)沒(méi)有理解
1)1.確保第一個(gè)解碼的幀為I幀,確保I幀中有sps和pps信息
2)如果直接從rtsp流中一幀一幀的取,再一幀一幀的轉(zhuǎn)碼yuv,對(duì)AVpacket,AVframe沒(méi)有特殊要求,完整就好。
3) 若果現(xiàn)將h264實(shí)時(shí)流存在共享內(nèi)存中,再?gòu)墓蚕韮?nèi)存中讀取一幀的AVpacket,那么AVframe就不要循環(huán)清理,最好做成成員變量,否則非關(guān)鍵幀無(wú)法解碼,會(huì)提示如上錯(cuò)誤。
1)static int h264_slice_header_parse(const H264Context *h, H264SliceContext *sl, const H2645NAL *nal)
??? if (!h->ps.pps_list[sl->pps_id]) {
??????? av_log(h->avctx, AV_LOG_ERROR,
?????????????? "non-existing PPS %u referenced\n",
?????????????? sl->pps_id);
??????? return AVERROR_INVALIDDATA;
??? }
2)static inline int parse_nal_units(AVCodecParserContext *s, AVCodecContext *avctx, const uint8_t * const buf, int buf_size)
??????????? if (!p->ps.pps_list[pps_id]) {
??????????????? av_log(avctx, AV_LOG_ERROR,
?????????????????????? "non-existing PPS %u referenced\n", pps_id);
??????????????? goto fail;
??????????? }
avcodec_send_packet函數(shù)返回-1094995529錯(cuò)誤,根據(jù)FFmpeg的錯(cuò)誤信息,得知為AVERROR_INVALIDDATA,猜測(cè)是第一種情況
在調(diào)用h264_slice_header_parse函數(shù)的時(shí)候,出現(xiàn)了錯(cuò)誤,無(wú)法定位PPS
函數(shù)的調(diào)用邏輯
static int decode_nal_units(H264Context *h, const uint8_t *buf, int buf_size)
?? ?int ff_h264_queue_decode_slice(H264Context *h, const H2645NAL *nal)
?? ??? ?static int h264_slice_header_parse(const H264Context *h, H264SliceContext *sl, const H2645NAL *nal)
結(jié)構(gòu)體的獲取
H264Context* pH264Context = AVCodecContext->priv_data
H264SliceContext *sl = H264Context->slice_ctx + H264Context->nb_slice_ctx_queued;
網(wǎng)上提供了一些方案,暫時(shí)沒(méi)有理解
1)1.確保第一個(gè)解碼的幀為I幀,確保I幀中有sps和pps信息
2)如果直接從rtsp流中一幀一幀的取,再一幀一幀的轉(zhuǎn)碼yuv,對(duì)AVpacket,AVframe沒(méi)有特殊要求,完整就好。
3) 若果現(xiàn)將h264實(shí)時(shí)流存在共享內(nèi)存中,再?gòu)墓蚕韮?nèi)存中讀取一幀的AVpacket,那么AVframe就不要循環(huán)清理,最好做成成員變量,否則非關(guān)鍵幀無(wú)法解碼,會(huì)提示如上錯(cuò)誤。
解決辦法:將AVframe做成成員變量,不能用一次清理一次
? ? ?本文轉(zhuǎn)自fengyuzaitu 51CTO博客,原文鏈接:http://blog.51cto.com/fengyuzaitu/2057885,如需轉(zhuǎn)載請(qǐng)自行聯(lián)系原作者
總結(jié)
以上是生活随笔為你收集整理的FFmpeg non-existing PPS 0 referenced问题描述的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。
- 上一篇: python2 安装 MySQL-py
- 下一篇: Facebook将在印度测试联网无人机,