Hi,

On Fri, Jun 24, 2011 at 9:38 AM, Phillip LeBlanc
<[email protected]> wrote:
> My initial approach involved following the tutorial at 
> http://dranger.com/ffmpeg/ (which conveniently saved frames to images) and I 
> added a log callback to parse for the error messages. Right before I call the 
> function to save the frame, I check to see if error_happened is equal to 1 
> (see below code snippets).
>
> void log_callback(void* ptr, int level, const char* fmt, va_list vl) {
>  AVClass* avc= ptr ? *(AVClass**)ptr : NULL;
>  if (level > av_log_get_level())
>    return;
>
>  if (avc && !strcmp(avc->item_name(ptr), "mpeg2video")){
>    error_happened = 1;
>    // Notify main function
>  }
> }
>
> ... and later on
>
> if (error_happened)
> {
>    error_happened=0;
>    fprintf(stderr, "Skipping frame #%d\n", i);
>    continue;
> }
>
> My question is, is this the best way to go about this?

No, because it assumes that the frame decoded is the frame returned to
the application also. That is not always correct (e.g. with
frame-threading or B-frames).

Set AVCodecContext->error_recognition to 0 to disable error
resilience. I _think_ that will do what you are looking for, but some
codecs may return uninitialized/zero data instead of discarding the
frame. Those are bugs that you can report and we'll fix them.

Ronald
_______________________________________________
libav-api mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-api

Reply via email to