I need help with decodein rtsp video stream. I get it from an AXIS IP camera. For this, I use the ffmpeg library. It is necessary to create AVCodecContext separately, and not from AVFormatContext-> streams [...] → codec;
So, I am creating AVCodec, AVCOdecContext and trying to initialize them.
AVCodec *codec=avcodec_find_decoder(codec_id); if(!codec) { qDebug()<<"FFMPEG failed to create codec"<<codec_id; return false; //--> } AVCodecContext *context=avcodec_alloc_context3(codec); if(!context) { qDebug()<<"FFMPEG failed to allocate codec context"; return false; //--> } avcodec_open2(context, codec, NULL);
Then in the main loop of the application, I get the frame data and try to decode:
_preallocatedFrame = avcodec_alloc_frame(); avcodec_decode_video2(_context, _preallocatedFrame, &got_picture, &_packet);
And here I get a lot of messages in the console:
[h264 @ 1f177720] decode_slice_header error [h264 @ 1f177720] no frame! [h264 @ 1f177720] non-existing PPS 0 referenced [h264 @ 1f177720] decode_slice_header error [h264 @ 1f177720] no frame! [h264 @ 1f177720] non-existing PPS 0 referenced [h264 @ 1f177720] decode_slice_header error [h264 @ 1f177720] no frame! [h264 @ 1f177720] non-existing PPS 0 referenced [h264 @ 1f177720] decode_slice_header error [h264 @ 1f177720] no frame! [h264 @ 1f177720] non-existing PPS 0 referenced [h264 @ 1f177720] decode_slice_header error [h264 @ 1f177720] no frame! [h264 @ 1f177720] non-existing PPS 0 referenced [h264 @ 1f177720] decode_slice_header error [h264 @ 1f177720] no frame!
Can you advise me something on how to run AVCodecContext or something else to do it right?
source share