Keep only the most recent in the fifo. This will use the most recent
frame for any initial padding after the start time instead of using
the very first frame.
---
libavfilter/vf_fps.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/libavfilter/vf_fps.c b/libavfilter/vf_fps.c
index 5f62ffd..d1393ba 100644
--- a/libavfilter/vf_fps.c
+++ b/libavfilter/vf_fps.c
@@ -209,6 +209,14 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *buf)
return write_to_fifo(s->fifo, buf);
}
+ /* discard frames before the start time, keeping only the most recent in
the fifo */
+ if (buf->pts < s->first_pts) {
+ av_log(ctx, AV_LOG_DEBUG, "Dropping %d frame(s).\n",
+ av_fifo_size(s->fifo)/sizeof(AVFrame*));
+ flush_fifo(s->fifo);
+ return write_to_fifo(s->fifo, buf);
+ }
+
/* number of output frames */
delta = av_rescale_q(buf->pts - s->pts, inlink->time_base,
outlink->time_base);
--
1.8.1.2
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel