Hi, I have seen, that filter select sometimes doesn't catch a frame determined by t as cause of floating point rounding. I could experience less problems after removing 2 times rounding in filter select. I'm aware that there still is a chance to miss a catch, but I believe it should be much more rare.
The patch works fine e.g. with: $ ./ffmpeg in.mp4 -vf select='eq(t\,10.16)+eq(t\,10.2)+eq(t\,10.24)+eq(t\,10.28)+eq(t\,10.32)+eq(t\,10.36)+eq(t\,10.4)+eq(t\,10.44)+eq(t\,17.52)+eq(t\,47.96)+eq(t\,49.08)+eq(t\,49.2)+eq(t\,55.72)+eq(t\,83.0)' -vsync vfr out_%02d.png Without the patch the frame for eq(t\,10.2) was missing. -Ulf
>From f14142a22d340cba48b3e2352a33026590dec3a5 Mon Sep 17 00:00:00 2001 From: Ulf Zibis <ulf.zi...@cosoco.de> Date: 19.07.2019, 18:27:51 avfilter/select: avoid twice rounding diff --git a/libavfilter/f_select.c b/libavfilter/f_select.c index 1132375..39cc004 100644 --- a/libavfilter/f_select.c +++ b/libavfilter/f_select.c @@ -297,6 +297,7 @@ #define D2TS(d) (isnan(d) ? AV_NOPTS_VALUE : (int64_t)(d)) #define TS2D(ts) ((ts) == AV_NOPTS_VALUE ? NAN : (double)(ts)) +#define TS2DT(ts, tb) (TS2D((ts) * (tb).num / (double)(tb).den)) static void select_frame(AVFilterContext *ctx, AVFrame *frame) { @@ -307,11 +308,11 @@ if (isnan(select->var_values[VAR_START_PTS])) select->var_values[VAR_START_PTS] = TS2D(frame->pts); if (isnan(select->var_values[VAR_START_T])) - select->var_values[VAR_START_T] = TS2D(frame->pts) * av_q2d(inlink->time_base); + select->var_values[VAR_START_T] = TS2DT(frame->pts, inlink->time_base); select->var_values[VAR_N ] = inlink->frame_count_out; select->var_values[VAR_PTS] = TS2D(frame->pts); - select->var_values[VAR_T ] = TS2D(frame->pts) * av_q2d(inlink->time_base); + select->var_values[VAR_T ] = TS2DT(frame->pts, inlink->time_base); select->var_values[VAR_POS] = frame->pkt_pos == -1 ? NAN : frame->pkt_pos; select->var_values[VAR_KEY] = frame->key_frame; select->var_values[VAR_CONCATDEC_SELECT] = get_concatdec_select(frame, av_rescale_q(frame->pts, inlink->time_base, AV_TIME_BASE_Q));
_______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".