ビデオの rtsp ストリームのデコードについて助けが必要です。AXIS IP カメラから取得します。ffmpeg ライブラリを使用します。AVFormatContext->streams[...]->codec; からではなく、AVCodecContext を個別に作成する必要があります。
だから私は AVCodec、AVCOdecContext を作成し、それらを初期化しようとします。
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);
次に、アプリケーションのメイン ループで、フレーム データを取得し、デコードを試みます。
_preallocatedFrame = avcodec_alloc_frame();
avcodec_decode_video2(_context, _preallocatedFrame, &got_picture, &_packet);
そして、ここで私はコンソールにたくさんのメッセージを受け取ります:
[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!
AVCodecContext を初期化する方法など、正しく行う方法を教えてもらえますか?