[FFmpeg-user] Check if a decoded frame is broken

Marton Balint cus at passwd.hu
Tue Jun 6 23:01:19 EEST 2017


On Tue, 6 Jun 2017, Wei.Yang wrote:

> i'm decoding video stream using ffmpeg, what i want to do is to check if 
> the picture is broken when a frame is decoded by 
> avcodec_decode_video2(). i call av_frame_get_decode_error_flags() on 
> decoded frame to get the errflags, but it returned 0 all the time. am i 
> calling the right function to get what i want? what's the right way to 
> check integrity of a decoded picture?

You need to check

- return value of avcodec_decode_video2 (or avcodec_send_packet/receive_frame)
- if you have a frame, then check
      - frame->decode_error_flags (any nonzero value means error)
      - frame->flags & AV_FRAME_FLAG_CORRUPT (some codecs set this and not the decode_error_flags)

I am afraid not all codecs properly report all failed decodings, but 
patches are welcome, if you find a decode error without signalling it in 
at least one way of the above three...

Regards,
Marton


More information about the ffmpeg-user mailing list