[FFmpeg-devel] [PATCH]Filter: Add snapshot filter. It is enable to save snapshot.

kl222 kl222 at 126.com
Wed Jun 1 09:55:31 CEST 2016

> On 28.05.2016 07:31, kl222 wrote:
> > On 27.05.2016 13:49, Nicolas George wrote:
> >> Can you explain your use case for this filter?
> >>
> >> I ask because I am very uncomfortable with filters that perform
> >> direct output instead of producing frames for the rest of the graph.
> >> They need to duplicate the encoding and muxing code, usually with
> >> fewer options and features, and that duplicated code becomes itself a
> >> maintenance burden in case of API changes and such.
> >>
> >> IMHO, a better solution would be some kind of "interactive select"
> >> (or just an option of plain select) filter, and encode its output as image2.
> >>
> >
> > I want to implement to the snapshot function whenever push stream, and
> > set the file name of snapshot picture.
> > this function can snapshot pictures before, between or after the other filters.
> > Because I want to change the file in filter, so duplicate the encoding
> > and muxing code can not be avoided.
> > OK, add it to "select" filter and a single filter patch. Chosen by you. see
> annex.
> The way you added it to the select filter it still uses own muxing code and
> doesn't allow to take full advantage of output format options.
> To give an idea what I had in mind when suggesting the select filter: The
> following command uses current FFmpeg code to generate snapshot files of the
> first two video
> frames:
> ffmpeg -i input-file.avi -f image2 -q 5 -filter:v "select=lt(selected_n\,2)" -y
> snapshot-%03d.jpg
> Now if the select filter code would be improved to allow updating the evaluated
> expression at run-time, sending filter commands like
> expr lt(selected_n,2)  // save two snapshot files expr lt(selected_n,3)  // add
> another snapshot file expr lt(selected_n,4)  // add another snapshot file
> could be used to trigger saving snapshot files on demand.

I understand your usage scenario. But I am not specified snapshot file name on the command line. But it needs to be updated it is, another program specified file name. So, I think as a separate filter is better.

More information about the ffmpeg-devel mailing list