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

2016-05-25 Thread kl222
Filter: Add snapshot filter. 
It can save a snapshot picture. Supports .png, .jpg, .bmp formats
Snapshot with process_command api.




0003-Filter-Add-snapshot-filter.-It-is-enable-to-save-sna.patch
Description: Binary data
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [patch]ffmpeg: read interaction command from a file.

2016-05-25 Thread kl222
ffmpeg: read interaction command from a file.



ffmpeg-read-interaction-command-from-a-file.patch
Description: Binary data
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


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

2016-05-27 Thread kl222
Sorry, the first submission. I modified the code, see Annex.


-邮件原件-
发件人: ffmpeg-devel-boun...@ffmpeg.org [mailto:ffmpeg-devel-boun...@ffmpeg.org] 
代表 Michael Niedermayer
发送时间: 2016年5月26日 19:24
收件人: FFmpeg development discussions and patches
主题: Re: [FFmpeg-devel] Filter: Add snapshot filter. It is enable to save 
snapshot.

On Wed, May 25, 2016 at 10:36:13PM +0800, kl222 wrote:
> Filter: Add snapshot filter. 
> It can save a snapshot picture. Supports .png, .jpg, .bmp formats 
> Snapshot with process_command api.
> 
> 

>  doc/filters.texi  |   23 
>  libavfilter/Makefile  |1 
>  libavfilter/allfilters.c  |1 
>  libavfilter/vf_snapshot.c |  234 
> ++
>  4 files changed, 259 insertions(+)
> 0982d4ea5c463a71f36cb6b984ef00e418ba1380  
> 0003-Filter-Add-snapshot-filter.-It-is-enable-to-save-sna.patch
> From a467346bea3849222c25aed2bb342b3d5fb51aeb Mon Sep 17 00:00:00 2001
> From: KangLin 
> Date: Wed, 25 May 2016 16:29:45 +0800
> Subject: [PATCH 3/3] Filter: Add snapshot filter. It is enable to save  
> snapshot.


[...]
> @@ -306,6 +306,7 @@ void avfilter_register_all(void)
>  REGISTER_FILTER(ZMQ,zmq,vf);
>  REGISTER_FILTER(ZOOMPAN,zoompan,vf);
>  REGISTER_FILTER(ZSCALE, zscale, vf);
> + REGISTER_FILTER(SNAPSHOT,   snapshot,   vf);

tabs are forbidden in ffmpeg git


>  
>  REGISTER_FILTER(ALLRGB, allrgb, vsrc);
>  REGISTER_FILTER(ALLYUV, allyuv, vsrc);

> diff --git a/libavfilter/vf_snapshot.c b/libavfilter/vf_snapshot.c new 
> file mode 100644 index 000..2c76ba5
> --- /dev/null
> +++ b/libavfilter/vf_snapshot.c
> @@ -0,0 +1,234 @@
> +/**
> + * @file
> + * Snapshot video filter, it can save a snapshot picture.
> + * Author:KangLin
> + */

Missing license header


[...]
> +static int snapshot_open(AVFilterContext *ctx, AVFrame* frame){
> +int ret = 0;
> +SnapshotContext *s = ctx->priv;
> +char f[1024] = { 0 };
> +if (s->ofmt_ctx)
> +return 0;
> +
> +if (s->pDir){
> +av_strlcpy(f, s->pDir, 1024);
> +av_strlcat(f, "/", 1024);
> +}
> +if (s->pFileName)
> +av_strlcat(f, s->pFileName, 1024);
> +else{
> +av_log(ctx, AV_LOG_ERROR, "please set filename.\n");
> +return AVERROR(EPERM);
> +}
> +
> +ret = avformat_alloc_output_context2(&s->ofmt_ctx, NULL, NULL, f);
> +if (ret < 0){
> +av_log(ctx, AV_LOG_ERROR, "open file is fail:%d;filename:%s\n", ret, 
> f);
> +return ret;
> +}
> +if (!s->ofmt_ctx) {
> +av_log(ctx, AV_LOG_ERROR, "open file is fail:%d\n", ret);
> +return ret;
> +}
> +
> +av_init_packet(&s->outPacket);
> +
> +do{
> +s->pEncodec = 
> avcodec_find_encoder(s->ofmt_ctx->oformat->video_codec);
> +if (!s->pEncodec){
> +av_log(ctx, AV_LOG_ERROR, "encodec isn't found.codec id:%d\n",
> +   s->ofmt_ctx->oformat->video_codec);
> +break;
> +}
> +
> +AVStream *out_stream = avformat_new_stream(s->ofmt_ctx, 
> + s->pEncodec);

libavfilter/vf_snapshot.c: In function ‘snapshot_open’:
libavfilter/vf_snapshot.c:102:9: warning: ISO C90 forbids mixed declarations 
and code [-Wdeclaration-after-statement]

[...]
-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

In fact, the RIAA has been known to suggest that students drop out of college 
or go to community college in order to be able to afford settlements. -- The 
RIAA


0001-avfilter-vf_snapshot-Add-snapshot-filter.-It-is-enab.patch
Description: Binary data
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


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

2016-05-27 Thread kl222
> -邮件原件-
> 发件人: ffmpeg-devel-boun...@ffmpeg.org
> [mailto:ffmpeg-devel-boun...@ffmpeg.org] 代表 Nicolas George
> 发送时间: 2016年5月27日 19:50
> 收件人: FFmpeg development discussions and patches
> 主题: Re: [FFmpeg-devel] 答复: [PATCH]Filter: Add snapshot filter. It is enable
> to save snapshot.
> 
> Le nonidi 9 prairial, an CCXXIV, kl222 a écrit :
> > 发件人: ffmpeg-devel-boun...@ffmpeg.org
> > [mailto:ffmpeg-devel-boun...@ffmpeg.org] 代表 Michael Niedermayer
> > 发送时间: 2016年5月26日 19:24
> > 收件人: FFmpeg development discussions and patches
> > 主题: Re: [FFmpeg-devel] Filter: Add snapshot filter. It is enable to save
> snapshot.
> 
> Plese remember that top-posting is not welcome on this mailing-list. See
> comments below on the patch itself.
> 
> > From: KangLin 
> > Date: Wed, 25 May 2016 16:29:45 +0800
> > Subject: [PATCH] avfilter/vf_snapshot: Add snapshot filter. It is
> > enable to  save snapshot.
> 
> For possible future evolutions, we need a long-term contact. Who would we call
> if the discussion of a global license change in the project were started?

I am copy the license from vf_smartblur.c. I am not discussion to cheange the 
license.

> >
> > Signed-off-by: KangLin 
> > ---
> >  doc/filters.texi  |  23 +
> >  libavfilter/Makefile  |   1 +
> >  libavfilter/allfilters.c  |   1 +
> >  libavfilter/vf_snapshot.c | 256
> > ++
> >  4 files changed, 281 insertions(+)
> >  create mode 100644 libavfilter/vf_snapshot.c
> >
> > diff --git a/doc/filters.texi b/doc/filters.texi index
> > aa208f1..a75005a 100644
> > --- a/doc/filters.texi
> > +++ b/doc/filters.texi
> > @@ -12037,6 +12037,29 @@ in [-30,0] will filter edges. Default value is 0.
> >  If a chroma option is not explicitly set, the corresponding luma
> > value  is set.
> >
> > +@section snapshot
> > +
> > +it can save a snapshot picture. Supports .png, .jpg, .bmp formats
> > +Snapshot with process_command api.
> 
> 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.

> > +
> > +It accepts the following options:
> > +
> > +@table @option
> > +@item directory
> > +Save the snapshot directory. Default value is snapshot.
> > +@item filename
> > +Snapshot file name
> > +@end table
> > +
> > +@example
> > +After ffmpeg start, when you want a snapshot, enter the following
> > +command at the command console:
> > +
> > +csnapshot -1 filename snapshot.png
> > +
> > +Save the snapshot to the snapshot directory.
> > +@end example
> > +
> >  @section ssim
> >
> >  Obtain the SSIM (Structural SImilarity Metric) between two input videos.
> > diff --git a/libavfilter/Makefile b/libavfilter/Makefile index
> > 65a831e..aceeed6 100644
> > --- a/libavfilter/Makefile
> > +++ b/libavfilter/Makefile
> > @@ -292,6 +292,7 @@ OBJS-$(CONFIG_YADIF_FILTER)
> += vf_yadif.o
> >  OBJS-$(CONFIG_ZMQ_FILTER)+= f_zmq.o
> >  OBJS-$(CONFIG_ZOOMPAN_FILTER)+= vf_zoompan.o
> >  OBJS-$(CONFIG_ZSCALE_FILTER) += vf_zscale.o
> > +OBJS-$(CONFIG_SNAPSHOT_FILTER)   += vf_snapshot.o
> >
> >  OBJS-$(CONFIG_ALLRGB_FILTER) += vsrc_testsrc.o
> >  OBJS-$(CONFIG_ALLYUV_FILTER) += vsrc_testsrc.o
> > diff --git a/libavfilter/allfilters.c b/libavfilter/allfilters.c index
> > d0d491e..b2e3b3c 100644
> > --- a/libavfilter/allfilters.c
> > +++ b/libavfilter/allfilters.c
> > @@ -307,6 +307,7 @@ void avfilter_register_all(void)
> >  REGISTER_FILTER(ZMQ,zmq,vf);
> >  REGISTER_FILTER(ZOOMPAN,zoompan,vf);
> >  REGISTER_FI

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

2016-06-01 Thread kl222
> 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.


___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel