Re: [FFmpeg-devel] [PATCH] lavfi: add drawgraph filter

2015-06-29 Thread Paul B Mahol
On 6/28/15, Paul B Mahol one...@gmail.com wrote:
 On 6/28/15, Dave Rice d...@dericed.com wrote:

 On Jun 28, 2015, at 1:54 PM, Paul B Mahol one...@gmail.com wrote:

 On 6/28/15, Dave Rice d...@dericed.com wrote:

 On Jun 28, 2015, at 11:07 AM, Paul B Mahol one...@gmail.com wrote:

 On 6/28/15, Dave Rice d...@dericed.com wrote:
 Hi,

 On Jun 27, 2015, at 4:52 PM, Paul B Mahol one...@gmail.com wrote:

 Signed-off-by: Paul B Mahol one...@gmail.com
 ---
 doc/filters.texi   |  76 
 libavfilter/Makefile   |   1 +
 libavfilter/allfilters.c   |   1 +
 libavfilter/vf_drawgraph.c | 297
 +
 4 files changed, 375 insertions(+)
 create mode 100644 libavfilter/vf_drawgraph.c


 [...]


 With this version using a color name for foreground no longer works:

 This works:
 ffplay -f lavfi -i mandelbrot -vf
 signalstats,drawgraph=metadata=lavfi.signalstats.YAVG:min=0:max=255:slide=scroll:bg=green:fg=0xFF

 This doesn't:
 ffplay -f lavfi -i mandelbrot -vf
 signalstats,drawgraph=metadata=lavfi.signalstats.YAVG:min=0:max=255:slide=scroll:bg=green:fg=red

 AFAIK The expressions can not work with strings.


 Also here's an example with blend:
 ffplay -f lavfi -i mandelbrot -vf signalstats,split=3[a][b][c];\
 [a]drawgraph=metadata=lavfi.signalstats.YAVG:min=0:max=255:slide=scroll:fg=0x:mode=dot[a1];\
 [b]drawgraph=metadata=lavfi.signalstats.UAVG:min=0:max=255:slide=scroll:fg=0xFF00FF00:mode=dot[b1];\
 [c]drawgraph=metadata=lavfi.signalstats.VAVG:min=0:max=255:slide=scroll:fg=0xFF00:mode=dot[c1];\
 [a1][b1]blend=and[ab];[ab][c1]blend=and[out]


 The blending kills difference in colors so I may add multiple graphs
 support for filter.

 Setting the background to black and blending seems a little better,
 though
 I'm losing one of my graphs in this example.

 ./ffplay -f lavfi -i mandelbrot -vf signalstats,split=3[a][b][c];\
 [a]drawgraph=lavfi.signalstats.YAVG:min=0:max=255:slide=scroll:bg=black:fg=0xFF:mode=dot[a1];\
 [b]drawgraph=lavfi.signalstats.YLOW:min=0:max=255:slide=scroll:bg=black:fg=0x00FF00:mode=dot[b1];\
 [c]drawgraph=lavfi.signalstats.YHIGH:min=0:max=255:slide=scroll:bg=black:fg=0xFF:mode=dot[c1];\
 [a1][b1]blend=lighten,[c1]blend=lighten[out]

 Also the foreground expression is in ABGR or BGR.  This is the opposite
 arrangement of what is specified here
 http://ffmpeg.org/ffmpeg-utils.html#Color.

 Using blend for this is SLOW.

 If the background could set to full alpha, then multiple graphs could be
 added together with the overlay filter. I tested some alpha expressions
 with
 bg (black@00, 0x) and didn't seem to get transparent results.

 Because filter use gbrp without alpha as output format. Will change it.
 Plan is use RGBA or even YUVA as final output.

Now it uses more friendly RGBA mode.



 Have you tried new 'line' mode?

 Oooo, this is great. Probably more readable than dot in many situations.

 Also expressions allow changing color of dot/line/bar so try it and
 tell me if its fine.

 I tested this with several modes and it works as expected (excepting that
 ABGR/BGR vs RGBA/RGB note). Thanks for adding this.

 Some other comments:
 I tried to use an equation within metadata but got no plotted result. For
 instance, metadata=pow(lavfi.signalstats.YMIN\,2). There are some
 values
 that may occur in a wide range, so a logarithmic or mathematically
 adjusted
 display may be preferable.

 Will see what can be done.

This complicates filter a lot, and I think this is more suited for
another filter
which will just operate on metadata values.



 Can input width and input height be used in variables within a size
 expression. In many cases I would like to draw the graph over the input
 video, but to do this I must know the input video size in advance.

 I do not understand what you want. You want to be able to set size of
 filter to input video?

This again complicates filter and disallows using WxH notation and
named notations.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] lavfi: add drawgraph filter

2015-06-28 Thread Paul B Mahol
On 6/28/15, Dave Rice d...@dericed.com wrote:
 Hi,

 On Jun 27, 2015, at 4:52 PM, Paul B Mahol one...@gmail.com wrote:

 Signed-off-by: Paul B Mahol one...@gmail.com
 ---
 doc/filters.texi   |  76 
 libavfilter/Makefile   |   1 +
 libavfilter/allfilters.c   |   1 +
 libavfilter/vf_drawgraph.c | 297
 +
 4 files changed, 375 insertions(+)
 create mode 100644 libavfilter/vf_drawgraph.c


[...]


 With this version using a color name for foreground no longer works:

 This works:
 ffplay -f lavfi -i mandelbrot -vf
 signalstats,drawgraph=metadata=lavfi.signalstats.YAVG:min=0:max=255:slide=scroll:bg=green:fg=0xFF

 This doesn't:
 ffplay -f lavfi -i mandelbrot -vf
 signalstats,drawgraph=metadata=lavfi.signalstats.YAVG:min=0:max=255:slide=scroll:bg=green:fg=red

AFAIK The expressions can not work with strings.


 Also here's an example with blend:
 ffplay -f lavfi -i mandelbrot -vf signalstats,split=3[a][b][c];\
 [a]drawgraph=metadata=lavfi.signalstats.YAVG:min=0:max=255:slide=scroll:fg=0x:mode=dot[a1];\
 [b]drawgraph=metadata=lavfi.signalstats.UAVG:min=0:max=255:slide=scroll:fg=0xFF00FF00:mode=dot[b1];\
 [c]drawgraph=metadata=lavfi.signalstats.VAVG:min=0:max=255:slide=scroll:fg=0xFF00:mode=dot[c1];\
 [a1][b1]blend=and[ab];[ab][c1]blend=and[out]


The blending kills difference in colors so I may add multiple graphs
support for filter.

 Thanks,
 Dave Rice

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

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


Re: [FFmpeg-devel] [PATCH] lavfi: add drawgraph filter

2015-06-28 Thread Dave Rice
Hi,

 On Jun 27, 2015, at 4:52 PM, Paul B Mahol one...@gmail.com wrote:
 
 Signed-off-by: Paul B Mahol one...@gmail.com
 ---
 doc/filters.texi   |  76 
 libavfilter/Makefile   |   1 +
 libavfilter/allfilters.c   |   1 +
 libavfilter/vf_drawgraph.c | 297 +
 4 files changed, 375 insertions(+)
 create mode 100644 libavfilter/vf_drawgraph.c
 
 diff --git a/doc/filters.texi b/doc/filters.texi
 index d9f913f..a1f8805 100644
 --- a/doc/filters.texi
 +++ b/doc/filters.texi
 @@ -3965,6 +3965,81 @@ 
 drawbox=x=-t:y=0.5*(ih-iw/2.4)-t:w=iw+t*2:h=iw/2.4+t*2:t=2:c=red
 @end example
 @end itemize
 
 +@section drawgraph
 +
 +Draw a graph using input video metadata.
 +
 +It accepts the following parameters:
 +
 +@table @option
 +@item metadata
 +Set frame metadata key from which metadata values will be used to draw a 
 graph.
 +
 +@item min
 +Set minimal value of metadata value.
 +
 +@item max
 +Set maximal value of metadata value.
 +
 +@item background
 +Set graph background color. Default is white.
 +
 +@item foreground
 +Set foreground color expression.
 +
 +The expressions can use the following variables:
 +
 +@table @option
 +@item MIN
 +Minimal value of metadata value.
 +
 +@item MAX
 +Maximal value of metadata value.
 +
 +@item VAL
 +Current metadata key value.
 +@end table
 +
 +@item mode
 +Set graph mode.
 +
 +Available values for mode is:
 +@table @samp
 +@item bar
 +@item dot
 +@item line
 +@end table
 +
 +Default is @code{bar}.
 +
 +@item slide
 +Set slide mode.
 +
 +Available values for slide is:
 +@table @samp
 +@item frame
 +Draw new frame when right border is reached.
 +
 +@item replace
 +Replace old columns with new ones.
 +
 +@item scroll
 +Scroll from right to left.
 +@end table
 +
 +Default is @code{frame}.
 +
 +@item size
 +Set size of graph video. For the syntax of this option, check the
 +@ref{video size syntax,,Video size section in the ffmpeg-utils 
 manual,ffmpeg-utils}.
 +The default value is @code{400x400}.
 +@end table
 +
 +Example using metadata from @ref{signalstats} filter:
 +@example
 +signalstats,drawgraph=lavfi.signalstats.YAVG:min=0:max=255
 +@end example
 +
 @section drawgrid
 
 Draw a grid on the input image.
 @@ -8604,6 +8679,7 @@ Swap the second and third planes of the input:
 ffmpeg -i INPUT -vf shuffleplanes=0:2:1:3 OUTPUT
 @end example
 
 +@anchor{signalstats}
 @section signalstats
 Evaluate various visual metrics that assist in determining issues associated
 with the digitization of analog video media.
 diff --git a/libavfilter/Makefile b/libavfilter/Makefile
 index 55cd055..54a8bbb 100644
 --- a/libavfilter/Makefile
 +++ b/libavfilter/Makefile
 @@ -117,6 +117,7 @@ OBJS-$(CONFIG_DELOGO_FILTER) += 
 vf_delogo.o
 OBJS-$(CONFIG_DESHAKE_FILTER)+= vf_deshake.o
 OBJS-$(CONFIG_DETELECINE_FILTER) += vf_detelecine.o
 OBJS-$(CONFIG_DRAWBOX_FILTER)+= vf_drawbox.o
 +OBJS-$(CONFIG_DRAWGRAPH_FILTER)  += vf_drawgraph.o
 OBJS-$(CONFIG_DRAWGRID_FILTER)   += vf_drawbox.o
 OBJS-$(CONFIG_DRAWTEXT_FILTER)   += vf_drawtext.o
 OBJS-$(CONFIG_ELBG_FILTER)   += vf_elbg.o
 diff --git a/libavfilter/allfilters.c b/libavfilter/allfilters.c
 index 3898498..b9508f5 100644
 --- a/libavfilter/allfilters.c
 +++ b/libavfilter/allfilters.c
 @@ -133,6 +133,7 @@ void avfilter_register_all(void)
 REGISTER_FILTER(DESHAKE,deshake,vf);
 REGISTER_FILTER(DETELECINE, detelecine, vf);
 REGISTER_FILTER(DRAWBOX,drawbox,vf);
 +REGISTER_FILTER(DRAWGRAPH,  drawgraph,  vf);
 REGISTER_FILTER(DRAWGRID,   drawgrid,   vf);
 REGISTER_FILTER(DRAWTEXT,   drawtext,   vf);
 REGISTER_FILTER(EDGEDETECT, edgedetect, vf);
 diff --git a/libavfilter/vf_drawgraph.c b/libavfilter/vf_drawgraph.c
 new file mode 100644
 index 000..642453a
 --- /dev/null
 +++ b/libavfilter/vf_drawgraph.c
 @@ -0,0 +1,297 @@
 +/*
 + * Copyright (c) 2015 Paul B Mahol
 + *
 + * 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 the implied warranty of
 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 + * Lesser General Public License for more details.
 + *
 + * You should have received a copy of the GNU Lesser General Public
 + * License along with FFmpeg; if not, write to the Free Software
 + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 
 USA
 + */
 +
 +#include float.h
 +
 +#include libavutil/eval.h
 +#include libavutil/intreadwrite.h
 +#include libavutil/opt.h
 +#include avfilter.h
 

Re: [FFmpeg-devel] [PATCH] lavfi: add drawgraph filter

2015-06-28 Thread Michael Niedermayer
On Sun, Jun 28, 2015 at 03:07:00PM +, Paul B Mahol wrote:
 On 6/28/15, Dave Rice d...@dericed.com wrote:
  Hi,
 
  On Jun 27, 2015, at 4:52 PM, Paul B Mahol one...@gmail.com wrote:
 
  Signed-off-by: Paul B Mahol one...@gmail.com
  ---
  doc/filters.texi   |  76 
  libavfilter/Makefile   |   1 +
  libavfilter/allfilters.c   |   1 +
  libavfilter/vf_drawgraph.c | 297
  +
  4 files changed, 375 insertions(+)
  create mode 100644 libavfilter/vf_drawgraph.c
 
 
 [...]
 
 
  With this version using a color name for foreground no longer works:
 
  This works:
  ffplay -f lavfi -i mandelbrot -vf
  signalstats,drawgraph=metadata=lavfi.signalstats.YAVG:min=0:max=255:slide=scroll:bg=green:fg=0xFF
 
  This doesn't:
  ffplay -f lavfi -i mandelbrot -vf
  signalstats,drawgraph=metadata=lavfi.signalstats.YAVG:min=0:max=255:slide=scroll:bg=green:fg=red
 
 AFAIK The expressions can not work with strings.
 

 
  Also here's an example with blend:
  ffplay -f lavfi -i mandelbrot -vf signalstats,split=3[a][b][c];\
  [a]drawgraph=metadata=lavfi.signalstats.YAVG:min=0:max=255:slide=scroll:fg=0x:mode=dot[a1];\
  [b]drawgraph=metadata=lavfi.signalstats.UAVG:min=0:max=255:slide=scroll:fg=0xFF00FF00:mode=dot[b1];\
  [c]drawgraph=metadata=lavfi.signalstats.VAVG:min=0:max=255:slide=scroll:fg=0xFF00:mode=dot[c1];\
  [a1][b1]blend=and[ab];[ab][c1]blend=and[out]
 
 
 The blending kills difference in colors so I may add multiple graphs

maybe something like leaving the background as it was on the input
would allow drawing multiple by simply chaining multiple drawgraph
filters

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

Frequently ignored answer#1 FFmpeg bugs should be sent to our bugtracker. User
questions about the command line tools should be sent to the ffmpeg-user ML.
And questions about how to use libav* should be sent to the libav-user ML.


signature.asc
Description: Digital signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] lavfi: add drawgraph filter

2015-06-28 Thread Dave Rice

 On Jun 28, 2015, at 1:54 PM, Paul B Mahol one...@gmail.com wrote:
 
 On 6/28/15, Dave Rice d...@dericed.com wrote:
 
 On Jun 28, 2015, at 11:07 AM, Paul B Mahol one...@gmail.com wrote:
 
 On 6/28/15, Dave Rice d...@dericed.com wrote:
 Hi,
 
 On Jun 27, 2015, at 4:52 PM, Paul B Mahol one...@gmail.com wrote:
 
 Signed-off-by: Paul B Mahol one...@gmail.com
 ---
 doc/filters.texi   |  76 
 libavfilter/Makefile   |   1 +
 libavfilter/allfilters.c   |   1 +
 libavfilter/vf_drawgraph.c | 297
 +
 4 files changed, 375 insertions(+)
 create mode 100644 libavfilter/vf_drawgraph.c
 
 
 [...]
 
 
 With this version using a color name for foreground no longer works:
 
 This works:
 ffplay -f lavfi -i mandelbrot -vf
 signalstats,drawgraph=metadata=lavfi.signalstats.YAVG:min=0:max=255:slide=scroll:bg=green:fg=0xFF
 
 This doesn't:
 ffplay -f lavfi -i mandelbrot -vf
 signalstats,drawgraph=metadata=lavfi.signalstats.YAVG:min=0:max=255:slide=scroll:bg=green:fg=red
 
 AFAIK The expressions can not work with strings.
 
 
 Also here's an example with blend:
 ffplay -f lavfi -i mandelbrot -vf signalstats,split=3[a][b][c];\
 [a]drawgraph=metadata=lavfi.signalstats.YAVG:min=0:max=255:slide=scroll:fg=0x:mode=dot[a1];\
 [b]drawgraph=metadata=lavfi.signalstats.UAVG:min=0:max=255:slide=scroll:fg=0xFF00FF00:mode=dot[b1];\
 [c]drawgraph=metadata=lavfi.signalstats.VAVG:min=0:max=255:slide=scroll:fg=0xFF00:mode=dot[c1];\
 [a1][b1]blend=and[ab];[ab][c1]blend=and[out]
 
 
 The blending kills difference in colors so I may add multiple graphs
 support for filter.
 
 Setting the background to black and blending seems a little better, though
 I'm losing one of my graphs in this example.
 
 ./ffplay -f lavfi -i mandelbrot -vf signalstats,split=3[a][b][c];\
 [a]drawgraph=lavfi.signalstats.YAVG:min=0:max=255:slide=scroll:bg=black:fg=0xFF:mode=dot[a1];\
 [b]drawgraph=lavfi.signalstats.YLOW:min=0:max=255:slide=scroll:bg=black:fg=0x00FF00:mode=dot[b1];\
 [c]drawgraph=lavfi.signalstats.YHIGH:min=0:max=255:slide=scroll:bg=black:fg=0xFF:mode=dot[c1];\
 [a1][b1]blend=lighten,[c1]blend=lighten[out]
 
 Also the foreground expression is in ABGR or BGR.  This is the opposite
 arrangement of what is specified here
 http://ffmpeg.org/ffmpeg-utils.html#Color.
 
 Using blend for this is SLOW.

If the background could set to full alpha, then multiple graphs could be added 
together with the overlay filter. I tested some alpha expressions with bg 
(black@00, 0x) and didn’t seem to get transparent results.

 Have you tried new 'line' mode?

Oooo, this is great. Probably more readable than dot in many situations.

 Also expressions allow changing color of dot/line/bar so try it and
 tell me if its fine.

I tested this with several modes and it works as expected (excepting that 
ABGR/BGR vs RGBA/RGB note). Thanks for adding this.

Some other comments:
I tried to use an equation within metadata but got no plotted result. For 
instance, metadata=pow(lavfi.signalstats.YMIN\,2)”. There are some values that 
may occur in a wide range, so a logarithmic or mathematically adjusted display 
may be preferable.

Can input width and input height be used in variables within a size expression. 
In many cases I would like to draw the graph over the input video, but to do 
this I must know the input video size in advance.
Dave Rice
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] lavfi: add drawgraph filter

2015-06-28 Thread Paul B Mahol
On 6/28/15, Dave Rice d...@dericed.com wrote:

 On Jun 28, 2015, at 1:54 PM, Paul B Mahol one...@gmail.com wrote:

 On 6/28/15, Dave Rice d...@dericed.com wrote:

 On Jun 28, 2015, at 11:07 AM, Paul B Mahol one...@gmail.com wrote:

 On 6/28/15, Dave Rice d...@dericed.com wrote:
 Hi,

 On Jun 27, 2015, at 4:52 PM, Paul B Mahol one...@gmail.com wrote:

 Signed-off-by: Paul B Mahol one...@gmail.com
 ---
 doc/filters.texi   |  76 
 libavfilter/Makefile   |   1 +
 libavfilter/allfilters.c   |   1 +
 libavfilter/vf_drawgraph.c | 297
 +
 4 files changed, 375 insertions(+)
 create mode 100644 libavfilter/vf_drawgraph.c


 [...]


 With this version using a color name for foreground no longer works:

 This works:
 ffplay -f lavfi -i mandelbrot -vf
 signalstats,drawgraph=metadata=lavfi.signalstats.YAVG:min=0:max=255:slide=scroll:bg=green:fg=0xFF

 This doesn't:
 ffplay -f lavfi -i mandelbrot -vf
 signalstats,drawgraph=metadata=lavfi.signalstats.YAVG:min=0:max=255:slide=scroll:bg=green:fg=red

 AFAIK The expressions can not work with strings.


 Also here's an example with blend:
 ffplay -f lavfi -i mandelbrot -vf signalstats,split=3[a][b][c];\
 [a]drawgraph=metadata=lavfi.signalstats.YAVG:min=0:max=255:slide=scroll:fg=0x:mode=dot[a1];\
 [b]drawgraph=metadata=lavfi.signalstats.UAVG:min=0:max=255:slide=scroll:fg=0xFF00FF00:mode=dot[b1];\
 [c]drawgraph=metadata=lavfi.signalstats.VAVG:min=0:max=255:slide=scroll:fg=0xFF00:mode=dot[c1];\
 [a1][b1]blend=and[ab];[ab][c1]blend=and[out]


 The blending kills difference in colors so I may add multiple graphs
 support for filter.

 Setting the background to black and blending seems a little better,
 though
 I'm losing one of my graphs in this example.

 ./ffplay -f lavfi -i mandelbrot -vf signalstats,split=3[a][b][c];\
 [a]drawgraph=lavfi.signalstats.YAVG:min=0:max=255:slide=scroll:bg=black:fg=0xFF:mode=dot[a1];\
 [b]drawgraph=lavfi.signalstats.YLOW:min=0:max=255:slide=scroll:bg=black:fg=0x00FF00:mode=dot[b1];\
 [c]drawgraph=lavfi.signalstats.YHIGH:min=0:max=255:slide=scroll:bg=black:fg=0xFF:mode=dot[c1];\
 [a1][b1]blend=lighten,[c1]blend=lighten[out]

 Also the foreground expression is in ABGR or BGR.  This is the opposite
 arrangement of what is specified here
 http://ffmpeg.org/ffmpeg-utils.html#Color.

 Using blend for this is SLOW.

 If the background could set to full alpha, then multiple graphs could be
 added together with the overlay filter. I tested some alpha expressions with
 bg (black@00, 0x) and didn't seem to get transparent results.

Because filter use gbrp without alpha as output format. Will change it.
Plan is use RGBA or even YUVA as final output.


 Have you tried new 'line' mode?

 Oooo, this is great. Probably more readable than dot in many situations.

 Also expressions allow changing color of dot/line/bar so try it and
 tell me if its fine.

 I tested this with several modes and it works as expected (excepting that
 ABGR/BGR vs RGBA/RGB note). Thanks for adding this.

 Some other comments:
 I tried to use an equation within metadata but got no plotted result. For
 instance, metadata=pow(lavfi.signalstats.YMIN\,2). There are some values
 that may occur in a wide range, so a logarithmic or mathematically adjusted
 display may be preferable.

Will see what can be done.


 Can input width and input height be used in variables within a size
 expression. In many cases I would like to draw the graph over the input
 video, but to do this I must know the input video size in advance.

I do not understand what you want. You want to be able to set size of
filter to input video?

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

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


Re: [FFmpeg-devel] [PATCH] lavfi: add drawgraph filter

2015-06-27 Thread Paul B Mahol
Dana 26. 6. 2015. 21:26 osoba Dave Rice d...@dericed.com napisala je:

 Hi,

  On Jun 26, 2015, at 11:27 AM, Paul B Mahol one...@gmail.com wrote:
 
  Signed-off-by: Paul B Mahol one...@gmail.com
  ---
  Waiting for comments and flames.

 Here are some comments and flames:

 I noticed that when I set min to a value greater than max. I get a crash
with Bus error: 10.

Good catch, I forgot about checking this.


 There may be an issue with negative values for min/max. When I run:
 ffplay -f lavfi -i color=gray -vf
signalstats,drawgraph=lavfi.signalstats.YAVG:min=0:max=255
 I see a line scroll across the center of the window. When I change min to
-255 I see a line at ~3/4 down the frame, where I would expect -128 to be.
Does the min and max expect non-negative numbers.


It is, but it doesn't draw what you expect. It should start from middle and
either go up or down.

 It could be helpful to include equations within foreground, such as:
 ffplay -i movie.mkv -vf
signalstats,drawgraph=lavfi.signalstats.YAVG:min=0:max=255:foreground=if(gt(lavfi.signalstats.YAVG\,128)\,green\,red)
 or actually I could probably subsequently use geq to accomplish that.

Will do, filter does not redraw whole frame it just updates columns so
different colors for bars/dots make sense in special scenarios.

I planned to do multiple graphs for multiple metadata but perhaps it is
better to call filter multiple times and then blend frames together...


 Can you alias 's' for 'size' as many of the other filters do.
Will do.


 This is very helpful, thanks!

Do you have some other interesting idea worth implementing in filter I'm
listening.

 Dave

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


Re: [FFmpeg-devel] [PATCH] lavfi: add drawgraph filter

2015-06-27 Thread Dave Rice

 On Jun 27, 2015, at 3:47 AM, Paul B Mahol one...@gmail.com wrote:
 
 Dana 26. 6. 2015. 21:26 osoba Dave Rice d...@dericed.com napisala je:
 
 Hi,
 
 On Jun 26, 2015, at 11:27 AM, Paul B Mahol one...@gmail.com wrote:
 
 Signed-off-by: Paul B Mahol one...@gmail.com
 ---
 Waiting for comments and flames.
 
 Here are some comments and flames:
 
 I noticed that when I set min to a value greater than max. I get a crash
 with Bus error: 10.
 
 Good catch, I forgot about checking this.
 
 
 There may be an issue with negative values for min/max. When I run:
 ffplay -f lavfi -i color=gray -vf
 signalstats,drawgraph=lavfi.signalstats.YAVG:min=0:max=255
 I see a line scroll across the center of the window. When I change min to
 -255 I see a line at ~3/4 down the frame, where I would expect -128 to be.
 Does the min and max expect non-negative numbers.
 
 
 It is, but it doesn't draw what you expect. It should start from middle and
 either go up or down.

Not sure I understand ‘start from the middle’ vs min/max. Can you clarify in 
the documentation.

 It could be helpful to include equations within foreground, such as:
 ffplay -i movie.mkv -vf
 signalstats,drawgraph=lavfi.signalstats.YAVG:min=0:max=255:foreground=if(gt(lavfi.signalstats.YAVG\,128)\,green\,red)
 or actually I could probably subsequently use geq to accomplish that.
 
 Will do, filter does not redraw whole frame it just updates columns so
 different colors for bars/dots make sense in special scenarios.

Updating columns (as opposed to whole frame redraw) was what I was imagining. 
This would be helpful for showing when a value crosses a particular threshold.

 I planned to do multiple graphs for multiple metadata but perhaps it is
 better to call filter multiple times and then blend frames together…

Yes, I was thinking of asking for that in a comment earlier but also thought 
calling it multiple times would be better. In many cases one may need different 
min/max values and it’s likely one would be different foreground values per 
value, so I think multiple calls would be fine.

 Can you alias 's' for 'size' as many of the other filters do.
 Will do.
 
 
 This is very helpful, thanks!
 
 Do you have some other interesting idea worth implementing in filter I'm
 listening.

This drawgraph filter seems like a good way to incorporate features I normal 
pull from QCTools (http://bavc.org/qctools, http://github.com/bavc/qctools) 
into a player. In particular I’d like to use drawgraph when running video 
digitization processes from tape. Currently when going tape-to-file I use a 
filterchain like this 
https://github.com/amiaopensource/vrecord/blob/master/vrecord#L219-L256 to show 
the video with a waveform and vectorscope. I think a flaw in this type of 
monitoring during digitization is that the user can only observe the current 
frame. So if something is seen in the corner of the eye (like a tape glitch, 
SDI spike, quick head clog) the user doesn’t have a chance to review that until 
the capture is done. With drawgraph incorporated in this the last X seconds of 
video could be summarized through signalstats data.

Thanks!
Dave

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

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


[FFmpeg-devel] [PATCH] lavfi: add drawgraph filter

2015-06-27 Thread Paul B Mahol
Signed-off-by: Paul B Mahol one...@gmail.com
---
 doc/filters.texi   |  76 
 libavfilter/Makefile   |   1 +
 libavfilter/allfilters.c   |   1 +
 libavfilter/vf_drawgraph.c | 297 +
 4 files changed, 375 insertions(+)
 create mode 100644 libavfilter/vf_drawgraph.c

diff --git a/doc/filters.texi b/doc/filters.texi
index d9f913f..a1f8805 100644
--- a/doc/filters.texi
+++ b/doc/filters.texi
@@ -3965,6 +3965,81 @@ 
drawbox=x=-t:y=0.5*(ih-iw/2.4)-t:w=iw+t*2:h=iw/2.4+t*2:t=2:c=red
 @end example
 @end itemize
 
+@section drawgraph
+
+Draw a graph using input video metadata.
+
+It accepts the following parameters:
+
+@table @option
+@item metadata
+Set frame metadata key from which metadata values will be used to draw a graph.
+
+@item min
+Set minimal value of metadata value.
+
+@item max
+Set maximal value of metadata value.
+
+@item background
+Set graph background color. Default is white.
+
+@item foreground
+Set foreground color expression.
+
+The expressions can use the following variables:
+
+@table @option
+@item MIN
+Minimal value of metadata value.
+
+@item MAX
+Maximal value of metadata value.
+
+@item VAL
+Current metadata key value.
+@end table
+
+@item mode
+Set graph mode.
+
+Available values for mode is:
+@table @samp
+@item bar
+@item dot
+@item line
+@end table
+
+Default is @code{bar}.
+
+@item slide
+Set slide mode.
+
+Available values for slide is:
+@table @samp
+@item frame
+Draw new frame when right border is reached.
+
+@item replace
+Replace old columns with new ones.
+
+@item scroll
+Scroll from right to left.
+@end table
+
+Default is @code{frame}.
+
+@item size
+Set size of graph video. For the syntax of this option, check the
+@ref{video size syntax,,Video size section in the ffmpeg-utils 
manual,ffmpeg-utils}.
+The default value is @code{400x400}.
+@end table
+
+Example using metadata from @ref{signalstats} filter:
+@example
+signalstats,drawgraph=lavfi.signalstats.YAVG:min=0:max=255
+@end example
+
 @section drawgrid
 
 Draw a grid on the input image.
@@ -8604,6 +8679,7 @@ Swap the second and third planes of the input:
 ffmpeg -i INPUT -vf shuffleplanes=0:2:1:3 OUTPUT
 @end example
 
+@anchor{signalstats}
 @section signalstats
 Evaluate various visual metrics that assist in determining issues associated
 with the digitization of analog video media.
diff --git a/libavfilter/Makefile b/libavfilter/Makefile
index 55cd055..54a8bbb 100644
--- a/libavfilter/Makefile
+++ b/libavfilter/Makefile
@@ -117,6 +117,7 @@ OBJS-$(CONFIG_DELOGO_FILTER) += vf_delogo.o
 OBJS-$(CONFIG_DESHAKE_FILTER)+= vf_deshake.o
 OBJS-$(CONFIG_DETELECINE_FILTER) += vf_detelecine.o
 OBJS-$(CONFIG_DRAWBOX_FILTER)+= vf_drawbox.o
+OBJS-$(CONFIG_DRAWGRAPH_FILTER)  += vf_drawgraph.o
 OBJS-$(CONFIG_DRAWGRID_FILTER)   += vf_drawbox.o
 OBJS-$(CONFIG_DRAWTEXT_FILTER)   += vf_drawtext.o
 OBJS-$(CONFIG_ELBG_FILTER)   += vf_elbg.o
diff --git a/libavfilter/allfilters.c b/libavfilter/allfilters.c
index 3898498..b9508f5 100644
--- a/libavfilter/allfilters.c
+++ b/libavfilter/allfilters.c
@@ -133,6 +133,7 @@ void avfilter_register_all(void)
 REGISTER_FILTER(DESHAKE,deshake,vf);
 REGISTER_FILTER(DETELECINE, detelecine, vf);
 REGISTER_FILTER(DRAWBOX,drawbox,vf);
+REGISTER_FILTER(DRAWGRAPH,  drawgraph,  vf);
 REGISTER_FILTER(DRAWGRID,   drawgrid,   vf);
 REGISTER_FILTER(DRAWTEXT,   drawtext,   vf);
 REGISTER_FILTER(EDGEDETECT, edgedetect, vf);
diff --git a/libavfilter/vf_drawgraph.c b/libavfilter/vf_drawgraph.c
new file mode 100644
index 000..642453a
--- /dev/null
+++ b/libavfilter/vf_drawgraph.c
@@ -0,0 +1,297 @@
+/*
+ * Copyright (c) 2015 Paul B Mahol
+ *
+ * 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 the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with FFmpeg; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include float.h
+
+#include libavutil/eval.h
+#include libavutil/intreadwrite.h
+#include libavutil/opt.h
+#include avfilter.h
+#include formats.h
+#include internal.h
+#include video.h
+
+typedef struct DrawGraphContext {
+const AVClass *class;
+
+char  *key;
+float min;
+float max;
+char  

[FFmpeg-devel] [PATCH] lavfi: add drawgraph filter

2015-06-26 Thread Paul B Mahol
Signed-off-by: Paul B Mahol one...@gmail.com
---
Waiting for comments and flames.
---
 doc/filters.texi   |  57 +++
 libavfilter/Makefile   |   1 +
 libavfilter/allfilters.c   |   1 +
 libavfilter/vf_drawgraph.c | 231 +
 4 files changed, 290 insertions(+)
 create mode 100644 libavfilter/vf_drawgraph.c

diff --git a/doc/filters.texi b/doc/filters.texi
index d9f913f..3125fbf 100644
--- a/doc/filters.texi
+++ b/doc/filters.texi
@@ -3965,6 +3965,62 @@ 
drawbox=x=-t:y=0.5*(ih-iw/2.4)-t:w=iw+t*2:h=iw/2.4+t*2:t=2:c=red
 @end example
 @end itemize
 
+@section drawgraph
+
+Draw a graph using input video metadata.
+
+It accepts the following parameters:
+
+@table @option
+@item metadata
+Set frame metadata key from which metadata values will be used to draw a graph.
+
+@item min
+Set minimal value of metadata value.
+
+@item max
+Set maximal value of metadata value.
+
+@item background
+Set graph background color.
+
+@item foreground
+Set foreground color.
+
+@item mode
+Set graph mode.
+
+Available values for mode is:
+@table @samp
+@item bar
+@item dot
+@end table
+
+Default is @code{bar}.
+
+@item slide
+Set slide mode.
+
+Available values for slide is:
+@table @samp
+@item frame
+@item replace
+@item scroll
+@end table
+
+Default is @code{frame}.
+
+@item size
+Set size of graph video. For the syntax of this option, check the
+@ref{video size syntax,,Video size section in the ffmpeg-utils 
manual,ffmpeg-utils}.
+The default value is @code{400x400}.
+@end table
+
+Example using metadata from @ref{signalstats} filter:
+@example
+signalstats,drawgraph=lavfi.signalstats.YAVG:min=0:max=255
+@end example
+
 @section drawgrid
 
 Draw a grid on the input image.
@@ -8604,6 +8660,7 @@ Swap the second and third planes of the input:
 ffmpeg -i INPUT -vf shuffleplanes=0:2:1:3 OUTPUT
 @end example
 
+@anchor{signalstats}
 @section signalstats
 Evaluate various visual metrics that assist in determining issues associated
 with the digitization of analog video media.
diff --git a/libavfilter/Makefile b/libavfilter/Makefile
index 55cd055..54a8bbb 100644
--- a/libavfilter/Makefile
+++ b/libavfilter/Makefile
@@ -117,6 +117,7 @@ OBJS-$(CONFIG_DELOGO_FILTER) += vf_delogo.o
 OBJS-$(CONFIG_DESHAKE_FILTER)+= vf_deshake.o
 OBJS-$(CONFIG_DETELECINE_FILTER) += vf_detelecine.o
 OBJS-$(CONFIG_DRAWBOX_FILTER)+= vf_drawbox.o
+OBJS-$(CONFIG_DRAWGRAPH_FILTER)  += vf_drawgraph.o
 OBJS-$(CONFIG_DRAWGRID_FILTER)   += vf_drawbox.o
 OBJS-$(CONFIG_DRAWTEXT_FILTER)   += vf_drawtext.o
 OBJS-$(CONFIG_ELBG_FILTER)   += vf_elbg.o
diff --git a/libavfilter/allfilters.c b/libavfilter/allfilters.c
index 3898498..b9508f5 100644
--- a/libavfilter/allfilters.c
+++ b/libavfilter/allfilters.c
@@ -133,6 +133,7 @@ void avfilter_register_all(void)
 REGISTER_FILTER(DESHAKE,deshake,vf);
 REGISTER_FILTER(DETELECINE, detelecine, vf);
 REGISTER_FILTER(DRAWBOX,drawbox,vf);
+REGISTER_FILTER(DRAWGRAPH,  drawgraph,  vf);
 REGISTER_FILTER(DRAWGRID,   drawgrid,   vf);
 REGISTER_FILTER(DRAWTEXT,   drawtext,   vf);
 REGISTER_FILTER(EDGEDETECT, edgedetect, vf);
diff --git a/libavfilter/vf_drawgraph.c b/libavfilter/vf_drawgraph.c
new file mode 100644
index 000..405e5fb
--- /dev/null
+++ b/libavfilter/vf_drawgraph.c
@@ -0,0 +1,231 @@
+/*
+ * Copyright (c) 2015 Paul B Mahol
+ *
+ * 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 the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with FFmpeg; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include float.h
+
+#include libavutil/opt.h
+#include avfilter.h
+#include formats.h
+#include internal.h
+#include video.h
+
+typedef struct DrawGraphContext {
+const AVClass *class;
+
+char  *key;
+float min;
+float max;
+uint8_t   bg[4];
+uint8_t   fg[4];
+int   mode;
+int   slide;
+int   w, h;
+
+AVFrame   *out;
+int   x;
+} DrawGraphContext;
+
+#define OFFSET(x) offsetof(DrawGraphContext, x)
+#define FLAGS AV_OPT_FLAG_VIDEO_PARAM|AV_OPT_FLAG_FILTERING_PARAM
+
+static const AVOption drawgraph_options[] = {
+{ metadata, set metadata key, OFFSET(key), 

Re: [FFmpeg-devel] [PATCH] lavfi: add drawgraph filter

2015-06-26 Thread Dave Rice
Hi,

 On Jun 26, 2015, at 11:27 AM, Paul B Mahol one...@gmail.com wrote:
 
 Signed-off-by: Paul B Mahol one...@gmail.com
 ---
 Waiting for comments and flames.

Here are some comments and flames:

I noticed that when I set min to a value greater than max. I get a crash with 
Bus error: 10.

There may be an issue with negative values for min/max. When I run:
ffplay -f lavfi -i color=gray -vf 
signalstats,drawgraph=lavfi.signalstats.YAVG:min=0:max=255
I see a line scroll across the center of the window. When I change min to -255 
I see a line at ~3/4 down the frame, where I would expect -128 to be. Does the 
min and max expect non-negative numbers.

It could be helpful to include equations within foreground, such as:
ffplay -i movie.mkv -vf 
signalstats,drawgraph=lavfi.signalstats.YAVG:min=0:max=255:foreground=if(gt(lavfi.signalstats.YAVG\,128)\,green\,red)
or actually I could probably subsequently use geq to accomplish that.

Can you alias 's' for 'size' as many of the other filters do.

This is very helpful, thanks!
Dave

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