[FFmpeg-devel] [PATCH]lavfi/decimate: Do not drop first frame
Carl Eugen Hoyos
cehoyos at ag.or.at
Sun Dec 20 16:26:07 CET 2015
Hi!
Video filter decimate currently (always) drops the first frame
because its diff values are all 0. Attached patch tries to fix
ticket #4990.
Better suggestions on how to detect "first frame" welcome.
Please comment, Carl Eugen
-------------- next part --------------
diff --git a/libavfilter/vf_decimate.c b/libavfilter/vf_decimate.c
index cd374c3..55100fc 100644
--- a/libavfilter/vf_decimate.c
+++ b/libavfilter/vf_decimate.c
@@ -177,6 +177,10 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in)
dm->fid = 0;
/* we have a complete cycle, select the frame to drop */
+ if (!outlink->frame_count) {
+ dm->queue[0].totdiff = dm->scthresh;
+ dm->queue[0].maxbdiff = INT64_MAX;
+ }
lowest = 0;
for (i = 0; i < dm->cycle; i++) {
if (dm->queue[i].totdiff > dm->scthresh)
More information about the ffmpeg-devel
mailing list