[FFmpeg-devel] [PATCH] libavcodec/h263dec.c: Duplicate the last decoded frame when xvid marks the packet as skipped.

Thierry Foucu tfoucu at gmail.com
Fri Oct 20 02:20:48 EEST 2017


On Thu, Oct 19, 2017 at 3:43 PM, Michael Niedermayer <michael at niedermayer.cc
> wrote:

> On Thu, Oct 19, 2017 at 09:51:05AM -0700, Thierry Foucu wrote:
> > Instead of returning nothing when we detect the xvid skipped frame, we
> > could return the last decoded frame, if we do have one.
>
> FRAME_SKIPPED is not limited to xvid (packed frames). There are a few
> other pathes that return it.
>
>
What if i change the test to check for mpeg4 video codec, something like

 if (ret == FRAME_SKIPPED) {
+        if (CONFIG_MPEG4_DECODER && actvx->codec_id == AV_CODEC_ID_MPEG4
&& s->next_picture_ptr) {
+            if ((ret = av_frame_ref(pict, s->next_picture_ptr->f)) < 0) {
+                return ret;
+            }
+            *got_frame = 1;
+        }
         return get_consumed_bytes(s, buf_size);
+    }

or should i do something specific for xvid bug? I could return another
value for the xvid (packed frames)  here
https://github.com/FFmpeg/FFmpeg/blob/master/libavcodec/mpeg4videodec.c#L2590

and check for it instead of the frame_skipped.

For standard mpeg4video, outputing the next frame smells like violating
> the spec.
>
>
i'm not output the next frame, i'm output the last decoded frame

The problem we have is that we have video with the last 5 second of it
being xvid packed frames.
When we demux the video, we assume the video to be 5 second long, but when
we decode it, we have only the first 2 frames, then all the others are
packed frames and so, the output is 2 frames long (instead of 5 seconds)

Here are the options we were thinking:
* if packed frames, duplicate and return the last frame if we  do have it
(this is this patch)
* increase the next PTS even if we have packed frames, so the last PTS is
passed down correctly to the filter chain when closing it and using the fps
filter, we could pad the last 5 second missing.



> [...]
>
> --
> Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
>
> Observe your enemies, for they first find out your faults. -- Antisthenes
>
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
>


More information about the ffmpeg-devel mailing list