FFmpeg non-existing PPS 0 referenced问题描述
生活随笔
收集整理的這篇文章主要介紹了
FFmpeg non-existing PPS 0 referenced问题描述
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
查看所有的函數引用
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函數返回-1094995529錯誤,根據FFmpeg的錯誤信息,得知為AVERROR_INVALIDDATA,猜測是第一種情況
在調用h264_slice_header_parse函數的時候,出現了錯誤,無法定位PPS
函數的調用邏輯
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)
結構體的獲取
H264Context* pH264Context = AVCodecContext->priv_data
H264SliceContext *sl = H264Context->slice_ctx + H264Context->nb_slice_ctx_queued;
網上提供了一些方案,暫時沒有理解
1)1.確保第一個解碼的幀為I幀,確保I幀中有sps和pps信息
2)如果直接從rtsp流中一幀一幀的取,再一幀一幀的轉碼yuv,對AVpacket,AVframe沒有特殊要求,完整就好。
3) 若果現將h264實時流存在共享內存中,再從共享內存中讀取一幀的AVpacket,那么AVframe就不要循環清理,最好做成成員變量,否則非關鍵幀無法解碼,會提示如上錯誤。
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函數返回-1094995529錯誤,根據FFmpeg的錯誤信息,得知為AVERROR_INVALIDDATA,猜測是第一種情況
在調用h264_slice_header_parse函數的時候,出現了錯誤,無法定位PPS
函數的調用邏輯
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)
結構體的獲取
H264Context* pH264Context = AVCodecContext->priv_data
H264SliceContext *sl = H264Context->slice_ctx + H264Context->nb_slice_ctx_queued;
網上提供了一些方案,暫時沒有理解
1)1.確保第一個解碼的幀為I幀,確保I幀中有sps和pps信息
2)如果直接從rtsp流中一幀一幀的取,再一幀一幀的轉碼yuv,對AVpacket,AVframe沒有特殊要求,完整就好。
3) 若果現將h264實時流存在共享內存中,再從共享內存中讀取一幀的AVpacket,那么AVframe就不要循環清理,最好做成成員變量,否則非關鍵幀無法解碼,會提示如上錯誤。
解決辦法:將AVframe做成成員變量,不能用一次清理一次
? ? ?本文轉自fengyuzaitu 51CTO博客,原文鏈接:http://blog.51cto.com/fengyuzaitu/2057885,如需轉載請自行聯系原作者
總結
以上是生活随笔為你收集整理的FFmpeg non-existing PPS 0 referenced问题描述的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: python2 安装 MySQL-py
- 下一篇: Facebook将在印度测试联网无人机,