[FFmpeg-trac] #2248(avfilter:new): select filter does not correctly set prev_pts

FFmpeg trac at avcodec.org
Thu Feb 7 19:13:46 CET 2013


#2248: select filter does not correctly set prev_pts
-------------------------------------+-------------------------------------
             Reporter:  schmod       |                     Type:  defect
               Status:  new          |                 Priority:  normal
            Component:  avfilter     |                  Version:  git-
             Keywords:  select       |  master
  aselect filter avfilter            |               Blocked By:
             Blocking:               |  Reproduced by developer:  0
Analyzed by developer:  0            |
-------------------------------------+-------------------------------------
 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);
 }}}

 [http://git.videolan.org/?p=ffmpeg.git;a=blob;f=libavfilter/f_select.c;h=4881a85ece8717d49d592a21699cfa1f2ded2b4e;hb=HEAD#l273]

 Note that I'm running ffmpeg on Windows, although this does not appear to
 be a platform-specific bug.

-- 
Ticket URL: <https://ffmpeg.org/trac/ffmpeg/ticket/2248>
FFmpeg <http://ffmpeg.org>
FFmpeg issue tracker


More information about the FFmpeg-trac mailing list