Opened 12 years ago
Closed 12 years ago
#2248 closed defect (fixed)
select filter does not correctly set prev_pts
Reported by: | Andrew | Owned by: | |
---|---|---|---|
Priority: | normal | Component: | avfilter |
Version: | git-master | Keywords: | select aselect filter avfilter |
Cc: | Blocked By: | ||
Blocking: | Reproduced by developer: | yes | |
Analyzed by developer: | yes |
Description
When using the select filter, the filter's internal pts
variable is always equal to prev_pts
. This is presumably not the intended (or a useful) behavior.
One would expect that prev_pts
should always be equal to the pts of the last frame that was processed (but not necessarily chosen) by the select filter.
For instance, if I filter a video for frames where the pts
is equal to prev_pts
:
ffmpeg -i big_buck_bunny_480p_surround-fix.avi -vf select='eq(prev_pts\,pts)',showinfo -frames:v 50 out.avi ffmpeg version N-49610-gc2dd5a1 Copyright (c) 2000-2013 the FFmpeg developers built on Feb 5 2013 13:26:02 with gcc 4.7.2 (GCC)
I get back the original video, rather than nothing at all (which is what you would expect).
Poking around in the source (f_select.c), I see that the values for PTS
and PREV_PTS
are both set in (basically) the same place. Presumably, PREV_PTS
should only be set *after* the filter has decided whether to select or discard the current frame?
273 select->var_values[VAR_PTS] = TS2D(ref->pts); 274 select->var_values[VAR_T ] = TS2D(ref->pts) * av_q2d(inlink->time_base); 275 select->var_values[VAR_POS] = ref->pos == -1 ? NAN : ref->pos; 276 select->var_values[VAR_PREV_PTS] = TS2D(ref ->pts);
Note that I'm running ffmpeg on Windows, although this does not appear to be a platform-specific bug.
Change History (1)
comment:1 by , 12 years ago
Analyzed by developer: | set |
---|---|
Reproduced by developer: | set |
Resolution: | → fixed |
Status: | new → closed |
Should be fixed in:
Bug was present since first filter commit, thanks for reporting.