[FFmpeg-devel] avcodec_check_frame_for_corruption?

Benjamin Larsson banan
Wed Mar 26 14:28:36 CET 2008

madshi wrote:
>  From reading the mailing list it appears to me that
> you ffmpeg/libav devs are quite strict with checking
> for possible error conditions etc. I like that a lot!
> Now I'm wondering:
> Is there any chance to add functionality to libav to
> make it possible for me as a programmer who uses
> libav to check a video or audio frame for corruption?
> My understanding is that currently all decoders try
> to work around corruption and still let decoding
> succeed somehow. E.g. the MPEG2 decoders still
> output frames even if the bitstream is damaged.
> The problem with that for me is that I cannot
> detect whether an audio or video frame was clean
> or corrupt. And that is what I'd like to find out.
> Maybe the video/audio decoders could set a flag
> somewhere when a frame was found to be damaged,
> but when decoding still worked fine? Another option
> would be if I could tell the decoders to let decoding
> fail if there's any corruption found in the bitstream.
> What do you think?
> Regards, madshi.

This sounds like a good feature. A simple approach would be to just add 
another avctx member and check it before and after calling decode().

Benjamin Larsson

More information about the ffmpeg-devel mailing list