[Libav-user] 971218 - MV errors in I frame

hamidi hamidi at gmail.com
Sat Mar 9 18:29:11 EET 2019


Hi
I get the following errors continually for each frame in my code:

[h264 @ 0108c8c0] error while decoding MB 71 44, bytestream -27
[h264 @ 0108c8c0] concealing 58 DC, 58 AC, 58 MV errors in I frame
[h264 @ 0108c8c0] error while decoding MB 53 4, bytestream -9
[h264 @ 0108c8c0] concealing 3276 DC, 3276 AC, 3276 MV errors in I frame
[h264 @ 0108c8c0] error while decoding MB 18 4, bytestream -5
[h264 @ 0108c8c0] concealing 3311 DC, 3311 AC, 3311 MV errors in I frame
[h264 @ 0108c8c0] error while decoding MB 22 3, bytestream -6
[h264 @ 0108c8c0] concealing 3387 DC, 3387 AC, 3387 MV errors in I frame

Now about my code:
I got frames from a Bosch camera in H264 and saved them in a file in a
special format. The format doesn't change the frames and just adds some
metadata information which is to be used by another parts of a program. Now
in my program I extract the original frames and try to decode them. This is
my code:

static unsafe int sw_play(byte* buf, int pos, int len, Int64 firstTimestamp)
{
AVCodecID codecId = AVCodecID.AV_CODEC_ID_H264;
_pCodec = FFmpegInvoke.avcodec_find_decoder(codecId);
Debug.Assert(_pCodec != null);
AVCodecContext* _pCodecContext =
FFmpegInvoke.avcodec_alloc_context3(_pCodec);
Debug.Assert(_pCodecContext != null);
Debug.Assert(FFmpegInvoke.avcodec_open2(_pCodecContext, _pCodec, null) ==
0);
_pCodecContext->codec_id = codecId;
_pCodecContext->time_base.num = 1;
_pCodecContext->time_base.den = 1000;
if ((_pCodec->capabilities & FFmpegInvoke.CODEC_CAP_TRUNCATED) != 0)
_pCodecContext->flags |= FFmpegInvoke.CODEC_FLAG_TRUNCATED;
_pCodecContext->width = 1280;
_pCodecContext->height = 720;
_pCodecContext->pix_fmt = (AVPixelFormat)0;
AVFrame* frame = FFmpegInvoke.av_frame_alloc();
Debug.Assert(frame != null);
RecordFrame* rf;
AVPacket packet;
FFmpegInvoke.av_init_packet(&packet);
AVFrame* _pDecodedFrame = FFmpegInvoke.av_frame_alloc();
while (true)
{
while (pos != len)
{
rf = (RecordFrame*)(buf + pos);
pos += sizeof(RecordFrame);
Debug.Assert(rf->frameType == (int)FrameType.FRAME_TYPE_STREAM);
packet.data = buf;
packet.size = rf->frameSize;
Debug.Assert(packet.size > 0);
packet.flags = rf->flags;
packet.dts = packet.pts = rf->timestamp - firstTimestamp;
packet.stream_index = 0;
int gotPicture = 0;
int size = FFmpegInvoke.avcodec_decode_video2(_pCodecContext,
_pDecodedFrame, &gotPicture, &packet);
Debug.Assert(size == packet.size);

pos += packet.size;
}
pos = sizeof(RecordFrame) + sizeof(RecordHeader);
}
FFmpegInvoke.av_frame_free(&frame);
}

What's wrong? The latest version of ffmpeg is used.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://ffmpeg.org/pipermail/libav-user/attachments/20190309/236a7e4f/attachment.html>


More information about the Libav-user mailing list