Re: [FFmpeg-devel] [PATCH] avfilter: add skipblend filter

2018-11-02 Thread Matthias Troffaes
Dear Paul,

On Thu, Nov 1, 2018 at 5:26 PM Paul B Mahol  wrote:
> > I found a way of doing this differently, as I now found that tmix
> > doesn't actually step frames, unlike skipblend. For history's sake,
> > the way to get skipblend behaviour is to do something like
> > "tmix=frames=100,framestep=150" for instance assuming you want to
> > blend 100 frames, skip 50, and so on. It is *much* slower compared to
> > skipblend by quite a large factor, as tmix does a lot of redundant
> > computations, but it works.
>
> I think that adding option to skip some frames can be added.

Thanks, that would be quite useful for performance. I'll then have a
look at contributing a patch to implement such option.

Kind regards,
Matthias
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] avfilter: add skipblend filter

2018-11-01 Thread Paul B Mahol
On 11/1/18, Matthias Troffaes  wrote:
> Dear Paul,
>
> On Thu, Nov 1, 2018 at 11:21 AM Matthias Troffaes
>  wrote:
>> Would you consider accepting a patch that added an integer "cutoff"
>> option to tmix, for the purpose of setting all weights for frames
>> beyond "cutoff" to 0? The reason for requesting this is that in some
>> workflows, one is blending together a lot of frames at once, and
>> specifying a vector of, say, 100 ones followed by a zero, when
>> blending together, say, 200 frames, whilst possible, is rather
>> tedious; for instance "tmix=frames=200:cutoff=100" (weights are 1 by
>> default so this should then work as expected).
>
> I found a way of doing this differently, as I now found that tmix
> doesn't actually step frames, unlike skipblend. For history's sake,
> the way to get skipblend behaviour is to do something like
> "tmix=frames=100,framestep=150" for instance assuming you want to
> blend 100 frames, skip 50, and so on. It is *much* slower compared to
> skipblend by quite a large factor, as tmix does a lot of redundant
> computations, but it works.

I think that adding option to skip some frames can be added.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] avfilter: add skipblend filter

2018-11-01 Thread Matthias Troffaes
Dear Paul,

On Thu, Nov 1, 2018 at 11:21 AM Matthias Troffaes
 wrote:
> Would you consider accepting a patch that added an integer "cutoff"
> option to tmix, for the purpose of setting all weights for frames
> beyond "cutoff" to 0? The reason for requesting this is that in some
> workflows, one is blending together a lot of frames at once, and
> specifying a vector of, say, 100 ones followed by a zero, when
> blending together, say, 200 frames, whilst possible, is rather
> tedious; for instance "tmix=frames=200:cutoff=100" (weights are 1 by
> default so this should then work as expected).

I found a way of doing this differently, as I now found that tmix
doesn't actually step frames, unlike skipblend. For history's sake,
the way to get skipblend behaviour is to do something like
"tmix=frames=100,framestep=150" for instance assuming you want to
blend 100 frames, skip 50, and so on. It is *much* slower compared to
skipblend by quite a large factor, as tmix does a lot of redundant
computations, but it works.

Kind regards,
Matthias
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] avfilter: add skipblend filter

2018-11-01 Thread Matthias Troffaes
Dear Paul,

On Thu, Nov 1, 2018 at 10:34 AM Paul B Mahol  wrote:
> Duplicates funcionality of tmix filter.

Many thanks for your reply, and for pointing out the existence of the
tmix filter. Please forgive my ignorance about it. I see tmix was only
added in April this year, whilst I've been carrying skipblend (and
tried getting it upstreamed a few times) since June 2017. No matter,
it's great to see this sort of functionality finally included!

Would you consider accepting a patch that added an integer "cutoff"
option to tmix, for the purpose of setting all weights for frames
beyond "cutoff" to 0? The reason for requesting this is that in some
workflows, one is blending together a lot of frames at once, and
specifying a vector of, say, 100 ones followed by a zero, when
blending together, say, 200 frames, whilst possible, is rather
tedious; for instance "tmix=frames=200:cutoff=100" (weights are 1 by
default so this should then work as expected).

Kind regards,
Matthias
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] avfilter: add skipblend filter

2018-11-01 Thread Paul B Mahol
On 11/1/18, Matthias Troffaes  wrote:
> Dear FFmpeg developers,
>
> ... is there a possibility for this patch to get applied? Obviously
> I'm happy to work further on the code where need be to get this
> upstreamed.

Duplicates funcionality of tmix filter.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] avfilter: add skipblend filter

2018-11-01 Thread Matthias Troffaes
Dear FFmpeg developers,

... is there a possibility for this patch to get applied? Obviously
I'm happy to work further on the code where need be to get this
upstreamed.

Kind regards,
Matthias
On Wed, Oct 24, 2018 at 11:14 AM Matthias Troffaes
 wrote:
>
> Attached a patch which adds a "skipblend" filter, which I've been
> using for a while. My hope is that an ffmpeg developer here can merge
> it. The filter is similar to the framestep filter, but additionally
> blends frames together at each step, for a motion blur effect. The
> number of frames that are blended (i.e. the exposure time, in frames)
> can be set, allowing control over the strength of the motion blur. The
> filter has timeline support, and supports both 8-bit and 16-bit pixel
> formats. Tests and documentation included.
>
> The main use so far that I (and others) have for this filter is to
> blend down high framerate footage, generated through computer
> rendering, to produce a high quality motion blur effect.
>
> Note that a similar effect is already possible by repeatedly chaining
> the tblend and framestep=step=2 filters; see for example:
>
> https://video.stackexchange.com/questions/16552/4x-resample-videoframes-using-ffmpeg
>
> But this is limited to steps that are powers of two, and this does not
> allow an intermediate exposure time. It's also slower.
>
> In the documentation, I've also added links between framestep, tblend,
> and the new skipblend filter, to help users to find the right filter
> they are looking for.
>
> Kind regards,
> Matthias
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH] avfilter: add skipblend filter

2018-10-24 Thread Matthias Troffaes
Attached a patch which adds a "skipblend" filter, which I've been
using for a while. My hope is that an ffmpeg developer here can merge
it. The filter is similar to the framestep filter, but additionally
blends frames together at each step, for a motion blur effect. The
number of frames that are blended (i.e. the exposure time, in frames)
can be set, allowing control over the strength of the motion blur. The
filter has timeline support, and supports both 8-bit and 16-bit pixel
formats. Tests and documentation included.

The main use so far that I (and others) have for this filter is to
blend down high framerate footage, generated through computer
rendering, to produce a high quality motion blur effect.

Note that a similar effect is already possible by repeatedly chaining
the tblend and framestep=step=2 filters; see for example:

https://video.stackexchange.com/questions/16552/4x-resample-videoframes-using-ffmpeg

But this is limited to steps that are powers of two, and this does not
allow an intermediate exposure time. It's also slower.

In the documentation, I've also added links between framestep, tblend,
and the new skipblend filter, to help users to find the right filter
they are looking for.

Kind regards,
Matthias
From 9f2f5b68d664ee879eed363c309cca887443251d Mon Sep 17 00:00:00 2001
From: "Matthias C. M. Troffaes" 
Date: Wed, 5 Apr 2017 11:56:04 +0100
Subject: [PATCH] avfilter: add skipblend filter

---
 Changelog  |   1 +
 doc/filters.texi   |  30 +++
 libavfilter/Makefile   |   1 +
 libavfilter/allfilters.c   |   1 +
 libavfilter/version.h  |   2 +-
 libavfilter/vf_skipblend.c | 272 +
 tests/fate/filter-video.mak|  12 ++
 tests/ref/fate/filter-skipblend-anim-1 |  17 ++
 tests/ref/fate/filter-skipblend-anim-2 |  17 ++
 tests/ref/fate/filter-skipblend-gray-1 |  14 ++
 tests/ref/fate/filter-skipblend-gray-2 |  13 ++
 11 files changed, 379 insertions(+), 1 deletion(-)
 create mode 100644 libavfilter/vf_skipblend.c
 create mode 100644 tests/ref/fate/filter-skipblend-anim-1
 create mode 100644 tests/ref/fate/filter-skipblend-anim-2
 create mode 100644 tests/ref/fate/filter-skipblend-gray-1
 create mode 100644 tests/ref/fate/filter-skipblend-gray-2

diff --git a/Changelog b/Changelog
index 0343ce9cd1..3545b3aa75 100644
--- a/Changelog
+++ b/Changelog
@@ -94,6 +94,7 @@ version 4.0:
 - segafilm muxer
 - vfrdet filter
 - SRCNN filter
+- skipblend video filter
 
 
 version 3.4:
diff --git a/doc/filters.texi b/doc/filters.texi
index 740eec670c..59fa9bffd2 100644
--- a/doc/filters.texi
+++ b/doc/filters.texi
@@ -5775,6 +5775,7 @@ The threshold below which a pixel value is considered black; it defaults to
 
 @end table
 
+@anchor{tblend}
 @section blend, tblend
 
 Blend two video frames into each other.
@@ -5786,6 +5787,8 @@ stream, the first input is the "top" layer and second input is
 The @code{tblend} (time blend) filter takes two consecutive frames
 from one single stream, and outputs the result obtained by blending
 the new frame on top of the old frame.
+See @ref{skipblend} for blending more than two frames at once
+from the same stream.
 
 A description of the accepted options follows.
 
@@ -9992,9 +9995,11 @@ This flag is enabled by default.
 @end table
 @end table
 
+@anchor{framestep}
 @section framestep
 
 Select one frame every N-th frame.
+See @ref{skipblend} for blending skipped frames.
 
 This filter accepts the following option:
 @table @option
@@ -15508,6 +15513,31 @@ ffmpeg -i input1.mkv -i input2.mkv -filter_complex "[0:v][1:v] signature=nb_inpu
 
 @end itemize
 
+@anchor{skipblend}
+@section skipblend
+
+Skip frames whilst blending skipped frames, for a motion blur
+effect. The number of frames that are blended (i.e. the exposure time,
+in frames) can be controlled, allowing control over the strength of the
+motion blur.
+See @ref{framestep} for skipping frames without blending.
+See @ref{tblend} for blending consecutive frames without skipping.
+
+This filter accepts the following options:
+@table @option
+@item step
+Skip @code{step} frames each step.
+Allowed values are positive integers between @code{1} and @code{65535}.
+Default value is @code{1}.
+@item blend
+Blend the first @code{blend} frames on every step,
+to produce a motion blur effect.
+Allowed values are positive integers between @code{1} and @code{step},
+where @code{1} corresponds to no motion blur, and @code{step}
+corresponds to maximal motion blur.
+Default value is @code{step}.
+@end table
+
 @anchor{smartblur}
 @section smartblur
 
diff --git a/libavfilter/Makefile b/libavfilter/Makefile
index 7beec310f8..1eaa47d9b6 100644
--- a/libavfilter/Makefile
+++ b/libavfilter/Makefile
@@ -356,6 +356,7 @@ OBJS-$(CONFIG_SHUFFLEPLANES_FILTER)  += vf_shuffleplanes.o
 OBJS-$(CONFIG_SIDEDATA_FILTER)   += f_sidedata.o
 OBJS-$(CONFIG_SIGNALSTATS_FILTER)+= 

Re: [FFmpeg-devel] [PATCH] avfilter: add skipblend filter

2017-07-21 Thread Matthias Troffaes
... any chance for this patch to get applied? Quick link to original thread:

https://ffmpeg.org/pipermail/ffmpeg-devel/2017-June/211866.html

Rebased version of patch against latest master attached.

Kind regards,
Matthias
diff --git a/Changelog b/Changelog
index 187ae79..4fa0870 100644
--- a/Changelog
+++ b/Changelog
@@ -29,6 +29,7 @@ version :
 - limiter video filter
 - libvmaf video filter
 - Dolby E decoder and SMPTE 337M demuxer
+- skipblend video filter
 
 version 3.3:
 - CrystalHD decoder moved to new decode API
diff --git a/doc/filters.texi b/doc/filters.texi
index 119d1be..45b01ac 100644
--- a/doc/filters.texi
+++ b/doc/filters.texi
@@ -4826,6 +4826,7 @@ The threshold below which a pixel value is considered black; it defaults to
 
 @end table
 
+@anchor{tblend}
 @section blend, tblend
 
 Blend two video frames into each other.
@@ -4837,6 +4838,8 @@ stream, the first input is the "top" layer and second input is
 The @code{tblend} (time blend) filter takes two consecutive frames
 from one single stream, and outputs the result obtained by blending
 the new frame on top of the old frame.
+See @ref{skipblend} for blending more than two frames at once
+from the same stream.
 
 A description of the accepted options follows.
 
@@ -8580,9 +8583,11 @@ This flag is enabled by default.
 @end table
 @end table
 
+@anchor{framestep}
 @section framestep
 
 Select one frame every N-th frame.
+See @ref{skipblend} for blending skipped frames.
 
 This filter accepts the following option:
 @table @option
@@ -13429,6 +13434,31 @@ ffmpeg -i input1.mkv -i input2.mkv -filter_complex "[0:v][1:v] signature=nb_inpu
 
 @end itemize
 
+@anchor{skipblend}
+@section skipblend
+
+Skip frames whilst blending skipped frames, for a motion blur
+effect. The number of frames that are blended (i.e. the exposure time,
+in frames) can be controlled, allowing control over the strength of the
+motion blur.
+See @ref{framestep} for skipping frames without blending.
+See @ref{tblend} for blending consecutive frames without skipping.
+
+This filter accepts the following options:
+@table @option
+@item step
+Skip @code{step} frames each step.
+Allowed values are positive integers between @code{1} and @code{65535}.
+Default value is @code{1}.
+@item blend
+Blend the first @code{blend} frames on every step,
+to produce a motion blur effect.
+Allowed values are positive integers between @code{1} and @code{step},
+where @code{1} corresponds to no motion blur, and @code{step}
+corresponds to maximal motion blur.
+Default value is @code{step}.
+@end table
+
 @anchor{smartblur}
 @section smartblur
 
diff --git a/libavfilter/Makefile b/libavfilter/Makefile
index ee16361..06930bb 100644
--- a/libavfilter/Makefile
+++ b/libavfilter/Makefile
@@ -295,6 +295,7 @@ OBJS-$(CONFIG_SHUFFLEPLANES_FILTER)  += vf_shuffleplanes.o
 OBJS-$(CONFIG_SIDEDATA_FILTER)   += f_sidedata.o
 OBJS-$(CONFIG_SIGNALSTATS_FILTER)+= vf_signalstats.o
 OBJS-$(CONFIG_SIGNATURE_FILTER)  += vf_signature.o
+OBJS-$(CONFIG_SKIPBLEND_FILTER)  += vf_skipblend.o
 OBJS-$(CONFIG_SMARTBLUR_FILTER)  += vf_smartblur.o
 OBJS-$(CONFIG_SOBEL_FILTER)  += vf_convolution.o
 OBJS-$(CONFIG_SPLIT_FILTER)  += split.o
diff --git a/libavfilter/allfilters.c b/libavfilter/allfilters.c
index b1c2d11..977604f 100644
--- a/libavfilter/allfilters.c
+++ b/libavfilter/allfilters.c
@@ -306,6 +306,7 @@ static void register_all(void)
 REGISTER_FILTER(SIDEDATA,   sidedata,   vf);
 REGISTER_FILTER(SIGNALSTATS,signalstats,vf);
 REGISTER_FILTER(SIGNATURE,  signature,  vf);
+REGISTER_FILTER(SKIPBLEND,  skipblend,  vf);
 REGISTER_FILTER(SMARTBLUR,  smartblur,  vf);
 REGISTER_FILTER(SOBEL,  sobel,  vf);
 REGISTER_FILTER(SPLIT,  split,  vf);
diff --git a/libavfilter/version.h b/libavfilter/version.h
index a252aec..01dd1db 100644
--- a/libavfilter/version.h
+++ b/libavfilter/version.h
@@ -30,7 +30,7 @@
 #include "libavutil/version.h"
 
 #define LIBAVFILTER_VERSION_MAJOR   6
-#define LIBAVFILTER_VERSION_MINOR  95
+#define LIBAVFILTER_VERSION_MINOR  96
 #define LIBAVFILTER_VERSION_MICRO 100
 
 #define LIBAVFILTER_VERSION_INT AV_VERSION_INT(LIBAVFILTER_VERSION_MAJOR, \
diff --git a/libavfilter/vf_skipblend.c b/libavfilter/vf_skipblend.c
new file mode 100644
index 000..2915b43
--- /dev/null
+++ b/libavfilter/vf_skipblend.c
@@ -0,0 +1,272 @@
+/*
+ * Copyright (c) 2012 Stefano Sabatini
+ * Copyright (c) 2017 Matthias C. M. Troffaes
+ *
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * FFmpeg is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even 

Re: [FFmpeg-devel] [PATCH] avfilter: add skipblend filter

2017-06-06 Thread Moritz Barsnick
On Tue, Jun 06, 2017 at 10:09:04 +0100, Matthias Troffaes wrote:
> > This maximum value is no longer correct.
> It's correct as far as I can tell. From the code:

Sorry, you're right and I'm wrong. I missed the change to int64.

> > Just wondering: Isn't this also useful for a slideshow-like
> > transition/fade, not just for motion blur? (I'm saying: If so, the user
> > needs to know.)
> 
> Good point, one could use it that way too, yes. I don't think it's
> essential to the patch, but I'd be happy to submit a follow-on patch
> to mention this use as well.

Yes, because "motion blur" is quite abstract to me. I used the
previously available filter(s) to "blend", i.e. blend "over" from one
image to another. On the time scale, that's still a blur, but a blur is
not what comes to mind visually.

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


Re: [FFmpeg-devel] [PATCH] avfilter: add skipblend filter

2017-06-06 Thread Matthias Troffaes
Dear Moritz,

On Mon, Jun 5, 2017 at 3:21 PM, Moritz Barsnick  wrote:
> I can't comment on the rest (and still really like the concept), but
> just this:
>
>> +Allowed values are positive integers between @code{1} and @code{65535}.
>
> This maximum value is no longer correct.

It's correct as far as I can tell. From the code:

{ "step", "set frame step",  OFFSET(frame_step), AV_OPT_TYPE_INT64,
{.i64=1}, 1, UINT16_MAX, FLAGS},

So you can see that UINT16_MAX (=65535) is the maximum value for the
step size, as documented. (Note that the type is AV_OPT_TYPE_INT64
because UINT16_MAX doesn't necessarily fit into an int, as you
correctly pointed out earlier.)

>> +Allowed values are positive integers between @code{1} and @code{step},
>> +where @code{1} corresponds to no motion blur, and @code{step}
>> +corresponds to maximal motion blur.
>
> Just wondering: Isn't this also useful for a slideshow-like
> transition/fade, not just for motion blur? (I'm saying: If so, the user
> needs to know.)

Good point, one could use it that way too, yes. I don't think it's
essential to the patch, but I'd be happy to submit a follow-on patch
to mention this use as well.

> I think I need to build and test it, to see if it fits
> my needs. ;)

Ok, thanks!

Kind regards,
Matthias
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] avfilter: add skipblend filter

2017-06-05 Thread Moritz Barsnick
I can't comment on the rest (and still really like the concept), but
just this:

> +Allowed values are positive integers between @code{1} and @code{65535}.

This maximum value is no longer correct.

> +Allowed values are positive integers between @code{1} and @code{step},
> +where @code{1} corresponds to no motion blur, and @code{step}
> +corresponds to maximal motion blur.

Just wondering: Isn't this also useful for a slideshow-like
transition/fade, not just for motion blur? (I'm saying: If so, the user
needs to know.) I think I need to build and test it, to see if it fits
my needs. ;)

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


[FFmpeg-devel] [PATCH] avfilter: add skipblend filter

2017-06-02 Thread Matthias C. M. Troffaes
---
 Changelog  |   1 +
 doc/filters.texi   |  30 
 libavfilter/Makefile   |   1 +
 libavfilter/allfilters.c   |   1 +
 libavfilter/version.h  |   2 +-
 libavfilter/vf_skipblend.c | 272 +
 tests/fate/filter-video.mak|  12 ++
 tests/ref/fate/filter-skipblend-anim-1 |  17 +++
 tests/ref/fate/filter-skipblend-anim-2 |  17 +++
 tests/ref/fate/filter-skipblend-gray-1 |  14 ++
 tests/ref/fate/filter-skipblend-gray-2 |  13 ++
 11 files changed, 379 insertions(+), 1 deletion(-)
 create mode 100644 libavfilter/vf_skipblend.c
 create mode 100644 tests/ref/fate/filter-skipblend-anim-1
 create mode 100644 tests/ref/fate/filter-skipblend-anim-2
 create mode 100644 tests/ref/fate/filter-skipblend-gray-1
 create mode 100644 tests/ref/fate/filter-skipblend-gray-2

diff --git a/Changelog b/Changelog
index 3533bdc..dc3c526 100644
--- a/Changelog
+++ b/Changelog
@@ -17,6 +17,7 @@ version :
 - remove the libnut muxer/demuxer wrappers
 - remove the libschroedinger encoder/decoder wrappers
 - surround audio filter
+- skipblend video filter
 
 version 3.3:
 - CrystalHD decoder moved to new decode API
diff --git a/doc/filters.texi b/doc/filters.texi
index d4fbb5a..8f9db0f 100644
--- a/doc/filters.texi
+++ b/doc/filters.texi
@@ -4724,6 +4724,7 @@ The threshold below which a pixel value is considered 
black; it defaults to
 
 @end table
 
+@anchor{tblend}
 @section blend, tblend
 
 Blend two video frames into each other.
@@ -4735,6 +4736,8 @@ stream, the first input is the "top" layer and second 
input is
 The @code{tblend} (time blend) filter takes two consecutive frames
 from one single stream, and outputs the result obtained by blending
 the new frame on top of the old frame.
+See @ref{skipblend} for blending more than two frames at once
+from the same stream.
 
 A description of the accepted options follows.
 
@@ -8474,9 +8477,11 @@ This flag is enabled by default.
 @end table
 @end table
 
+@anchor{framestep}
 @section framestep
 
 Select one frame every N-th frame.
+See @ref{skipblend} for blending skipped frames.
 
 This filter accepts the following option:
 @table @option
@@ -13128,6 +13133,31 @@ ffmpeg -i input1.mkv -i input2.mkv -filter_complex 
"[0:v][1:v] signature=nb_inpu
 
 @end itemize
 
+@anchor{skipblend}
+@section skipblend
+
+Skip frames whilst blending skipped frames, for a motion blur
+effect. The number of frames that are blended (i.e. the exposure time,
+in frames) can be controlled, allowing control over the strength of the
+motion blur.
+See @ref{framestep} for skipping frames without blending.
+See @ref{tblend} for blending consecutive frames without skipping.
+
+This filter accepts the following options:
+@table @option
+@item step
+Skip @code{step} frames each step.
+Allowed values are positive integers between @code{1} and @code{65535}.
+Default value is @code{1}.
+@item blend
+Blend the first @code{blend} frames on every step,
+to produce a motion blur effect.
+Allowed values are positive integers between @code{1} and @code{step},
+where @code{1} corresponds to no motion blur, and @code{step}
+corresponds to maximal motion blur.
+Default value is @code{step}.
+@end table
+
 @anchor{smartblur}
 @section smartblur
 
diff --git a/libavfilter/Makefile b/libavfilter/Makefile
index c88dfb3..6e01596 100644
--- a/libavfilter/Makefile
+++ b/libavfilter/Makefile
@@ -290,6 +290,7 @@ OBJS-$(CONFIG_SHUFFLEPLANES_FILTER)  += 
vf_shuffleplanes.o
 OBJS-$(CONFIG_SIDEDATA_FILTER)   += f_sidedata.o
 OBJS-$(CONFIG_SIGNALSTATS_FILTER)+= vf_signalstats.o
 OBJS-$(CONFIG_SIGNATURE_FILTER)  += vf_signature.o
+OBJS-$(CONFIG_SKIPBLEND_FILTER)  += vf_skipblend.o
 OBJS-$(CONFIG_SMARTBLUR_FILTER)  += vf_smartblur.o
 OBJS-$(CONFIG_SOBEL_FILTER)  += vf_convolution.o
 OBJS-$(CONFIG_SPLIT_FILTER)  += split.o
diff --git a/libavfilter/allfilters.c b/libavfilter/allfilters.c
index 534c340..605f2da 100644
--- a/libavfilter/allfilters.c
+++ b/libavfilter/allfilters.c
@@ -301,6 +301,7 @@ static void register_all(void)
 REGISTER_FILTER(SIDEDATA,   sidedata,   vf);
 REGISTER_FILTER(SIGNALSTATS,signalstats,vf);
 REGISTER_FILTER(SIGNATURE,  signature,  vf);
+REGISTER_FILTER(SKIPBLEND,  skipblend,  vf);
 REGISTER_FILTER(SMARTBLUR,  smartblur,  vf);
 REGISTER_FILTER(SOBEL,  sobel,  vf);
 REGISTER_FILTER(SPLIT,  split,  vf);
diff --git a/libavfilter/version.h b/libavfilter/version.h
index 11cfe51..1fa3cf7 100644
--- a/libavfilter/version.h
+++ b/libavfilter/version.h
@@ -30,7 +30,7 @@
 #include "libavutil/version.h"
 
 #define LIBAVFILTER_VERSION_MAJOR   6
-#define LIBAVFILTER_VERSION_MINOR  91
+#define LIBAVFILTER_VERSION_MINOR  92
 #define LIBAVFILTER_VERSION_MICRO 100
 
 #define 

[FFmpeg-devel] [PATCH] avfilter: add skipblend filter

2017-06-02 Thread Matthias C. M. Troffaes
Attached a patch which adds a "skipblend" filter, which is similar to
the framestep filter, but additionally blends frames together at each
step, for a motion blur effect. The number of frames that are blended
(i.e. the exposure time, in frames) can be set, allowing control over
the strength of the motion blur. The filter has timeline support, and
supports both 8-bit and 16-bit pixel formats. Tests and documentation
included.

This can be used for instance to blend down high framerate footage to
produce a high quality motion blur effect.

Note that a similar effect is already possible by repeatedly chaining
the tblend and framestep=step=2 filters; see for example:

https://video.stackexchange.com/questions/16552/4x-resample-videoframes-using-ffmpeg

But this is limited to steps that are powers of two, and this does not
allow an intermediate exposure time. It's also slower.

Issues addressed: fixed mips failure (reported by Michael), fixed
potential overflow on systems where int is only 16 bits wide (reported
by Moritz), fixed changelog entry position (reported by Moritz), moved
code out of framestep and instead create new filter (requested by Paul
& wm4, I agree this looks cleaner).

In the documentation, I've also added links between framestep, tblend,
and the new skipblend filter, to help users to find the right filter
they are looking for.

Feedback welcome as always.

Kind regards,
Matthias

PS. For reference, previous submissions of this patch with discussion:

https://ffmpeg.org/pipermail/ffmpeg-devel/2017-April/209794.html
https://ffmpeg.org/pipermail/ffmpeg-devel/2017-May/211814.html


Matthias C. M. Troffaes (1):
  avfilter: add skipblend filter

 Changelog  |   1 +
 doc/filters.texi   |  30 
 libavfilter/Makefile   |   1 +
 libavfilter/allfilters.c   |   1 +
 libavfilter/version.h  |   2 +-
 libavfilter/vf_skipblend.c | 272 +
 tests/fate/filter-video.mak|  12 ++
 tests/ref/fate/filter-skipblend-anim-1 |  17 +++
 tests/ref/fate/filter-skipblend-anim-2 |  17 +++
 tests/ref/fate/filter-skipblend-gray-1 |  14 ++
 tests/ref/fate/filter-skipblend-gray-2 |  13 ++
 11 files changed, 379 insertions(+), 1 deletion(-)
 create mode 100644 libavfilter/vf_skipblend.c
 create mode 100644 tests/ref/fate/filter-skipblend-anim-1
 create mode 100644 tests/ref/fate/filter-skipblend-anim-2
 create mode 100644 tests/ref/fate/filter-skipblend-gray-1
 create mode 100644 tests/ref/fate/filter-skipblend-gray-2

-- 
2.7.4

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