[FFmpeg-devel] [PATCH] lavfi: add (a)drawgraph filter

2015-06-29 Thread Paul B Mahol
Signed-off-by: Paul B Mahol one...@gmail.com
---
 Changelog |   1 +
 doc/filters.texi  | 101 ++
 libavfilter/Makefile  |   2 +
 libavfilter/allfilters.c  |   2 +
 libavfilter/f_drawgraph.c | 346 ++
 5 files changed, 452 insertions(+)
 create mode 100644 libavfilter/f_drawgraph.c

diff --git a/Changelog b/Changelog
index e3c94c7..f89c915 100644
--- a/Changelog
+++ b/Changelog
@@ -10,6 +10,7 @@ version next:
 - ssim filter
 - rewritten ASF demuxer
 - showvolume filter
+- adrawgraph audio and drawgraph video filter
 
 
 version 2.7:
diff --git a/doc/filters.texi b/doc/filters.texi
index 8b2c5ea..8a2f44b 100644
--- a/doc/filters.texi
+++ b/doc/filters.texi
@@ -3965,6 +3965,105 @@ 
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, adrawgraph
+
+Draw a graph using input video or audio metadata.
+
+It accepts the following parameters:
+
+@table @option
+@item m1
+Set 1st frame metadata key from which metadata values will be used to draw a 
graph.
+
+@item fg1
+Set 1st foreground color expression.
+
+@item m2
+Set 2nd frame metadata key from which metadata values will be used to draw a 
graph.
+
+@item fg2
+Set 2nd foreground color expression.
+
+@item m3
+Set 3rd frame metadata key from which metadata values will be used to draw a 
graph.
+
+@item fg3
+Set 3rd foreground color expression.
+
+@item m4
+Set 4th frame metadata key from which metadata values will be used to draw a 
graph.
+
+@item fg4
+Set 4th foreground color expression.
+
+@item min
+Set minimal value of metadata value.
+
+@item max
+Set maximal value of metadata value.
+
+@item bg
+Set graph background color. Default is white.
+
+@item mode
+Set graph mode.
+
+Available values for mode is:
+@table @samp
+@item bar
+@item dot
+@item line
+@end table
+
+Default is @code{line}.
+
+@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{900x256}.
+
+The foreground color 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
+
+The color is defined as 0xAABBGGRR.
+@end table
+
+Example using metadata from @ref{signalstats} filter:
+@example
+signalstats,drawgraph=lavfi.signalstats.YAVG:min=0:max=255
+@end example
+
+Example using metadata from @ref{ebur128} filter:
+@example
+ebur128=metadata=1,adrawgraph=lavfi.r128.M:min=-120:max=5
+@end example
+
 @section drawgrid
 
 Draw a grid on the input image.
@@ -8604,6 +8703,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.
@@ -11034,6 +11134,7 @@ do not have exactly the same duration in the first file.
 
 @end itemize
 
+@anchor{ebur128}
 @section ebur128
 
 EBU R128 scanner filter. This filter takes an audio stream as input and outputs
diff --git a/libavfilter/Makefile b/libavfilter/Makefile
index a5d7fc1..3e899f2 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)  += f_drawgraph.o
 OBJS-$(CONFIG_DRAWGRID_FILTER)   += vf_drawbox.o
 OBJS-$(CONFIG_DRAWTEXT_FILTER)   += vf_drawtext.o
 OBJS-$(CONFIG_ELBG_FILTER)   += vf_elbg.o
@@ -237,6 +238,7 @@ OBJS-$(CONFIG_TESTSRC_FILTER)+= 
vsrc_testsrc.o
 OBJS-$(CONFIG_NULLSINK_FILTER)   += vsink_nullsink.o
 
 # multimedia filters
+OBJS-$(CONFIG_ADRAWGRAPH_FILTER) += f_drawgraph.o
 OBJS-$(CONFIG_AVECTORSCOPE_FILTER)   += avf_avectorscope.o
 OBJS-$(CONFIG_CONCAT_FILTER) += avf_concat.o
 OBJS-$(CONFIG_SHOWCQT_FILTER)+= avf_showcqt.o
diff --git a/libavfilter/allfilters.c b/libavfilter/allfilters.c
index 33b4580..6493389 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,

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

2015-06-29 Thread Dave Rice
Hi,

 On Jun 29, 2015, at 12:31 AM, Paul B Mahol one...@gmail.com wrote:
 
 Signed-off-by: Paul B Mahol one...@gmail.com
 ---
 Changelog |   1 +
 doc/filters.texi  | 101 ++
 libavfilter/Makefile  |   2 +
 libavfilter/allfilters.c  |   2 +
 libavfilter/f_drawgraph.c | 346 ++
 5 files changed, 452 insertions(+)
 create mode 100644 libavfilter/f_drawgraph.c
 
 diff --git a/Changelog b/Changelog
 index e3c94c7..f89c915 100644
 --- a/Changelog
 +++ b/Changelog
 @@ -10,6 +10,7 @@ version next:
 - ssim filter
 - rewritten ASF demuxer
 - showvolume filter
 +- adrawgraph audio and drawgraph video filter
 
 
 version 2.7:
 diff --git a/doc/filters.texi b/doc/filters.texi
 index 8b2c5ea..8a2f44b 100644
 --- a/doc/filters.texi
 +++ b/doc/filters.texi
 @@ -3965,6 +3965,105 @@ 
 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, adrawgraph
 +
 +Draw a graph using input video or audio metadata.
 +
 +It accepts the following parameters:
 +
 +@table @option
 +@item m1
 +Set 1st frame metadata key from which metadata values will be used to draw a 
 graph.
 +
 +@item fg1
 +Set 1st foreground color expression.
 +
 +@item m2
 +Set 2nd frame metadata key from which metadata values will be used to draw a 
 graph.
 +
 +@item fg2
 +Set 2nd foreground color expression.
 +
 +@item m3
 +Set 3rd frame metadata key from which metadata values will be used to draw a 
 graph.
 +
 +@item fg3
 +Set 3rd foreground color expression.
 +
 +@item m4
 +Set 4th frame metadata key from which metadata values will be used to draw a 
 graph.
 +
 +@item fg4
 +Set 4th foreground color expression.
 +
 +@item min
 +Set minimal value of metadata value.
 +
 +@item max
 +Set maximal value of metadata value.
 +
 +@item bg
 +Set graph background color. Default is white.
 +
 +@item mode
 +Set graph mode.
 +
 +Available values for mode is:
 +@table @samp
 +@item bar
 +@item dot
 +@item line
 +@end table
 +
 +Default is @code{line}.
 +
 +@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{900x256}.
 +
 +The foreground color 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
 +
 +The color is defined as 0xAABBGGRR.
 +@end table
 +
 +Example using metadata from @ref{signalstats} filter:
 +@example
 +signalstats,drawgraph=lavfi.signalstats.YAVG:min=0:max=255
 +@end example
 +
 +Example using metadata from @ref{ebur128} filter:
 +@example
 +ebur128=metadata=1,adrawgraph=lavfi.r128.M:min=-120:max=5
 +@end example
 +
 @section drawgrid
 
 Draw a grid on the input image.
 @@ -8604,6 +8703,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.
 @@ -11034,6 +11134,7 @@ do not have exactly the same duration in the first 
 file.
 
 @end itemize
 
 +@anchor{ebur128}
 @section ebur128
 
 EBU R128 scanner filter. This filter takes an audio stream as input and 
 outputs
 diff --git a/libavfilter/Makefile b/libavfilter/Makefile
 index a5d7fc1..3e899f2 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)  += f_drawgraph.o
 OBJS-$(CONFIG_DRAWGRID_FILTER)   += vf_drawbox.o
 OBJS-$(CONFIG_DRAWTEXT_FILTER)   += vf_drawtext.o
 OBJS-$(CONFIG_ELBG_FILTER)   += vf_elbg.o
 @@ -237,6 +238,7 @@ OBJS-$(CONFIG_TESTSRC_FILTER)+= 
 vsrc_testsrc.o
 OBJS-$(CONFIG_NULLSINK_FILTER)   += vsink_nullsink.o
 
 # multimedia filters
 +OBJS-$(CONFIG_ADRAWGRAPH_FILTER) += f_drawgraph.o
 OBJS-$(CONFIG_AVECTORSCOPE_FILTER)   += avf_avectorscope.o
 OBJS-$(CONFIG_CONCAT_FILTER) += avf_concat.o
 OBJS-$(CONFIG_SHOWCQT_FILTER)+= avf_showcqt.o
 diff --git a/libavfilter/allfilters.c b/libavfilter/allfilters.c
 index 33b4580..6493389 100644
 --- a/libavfilter/allfilters.c
 +++ b/libavfilter/allfilters.c
 @@ 

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

2015-06-29 Thread Dave Rice

 On Jun 29, 2015, at 2:09 PM, Paul B Mahol one...@gmail.com wrote:
 
 On 6/29/15, Dave Rice d...@dericed.com wrote:
 Hi,
 
 
 [...]
 
 
 I re-tested and all looks great. The new default size, 900x256, makes sense
 and I'm glad to see it now works with audio metadata (would love to be able
 to use astats with this someday). I'm having a little trouble getting an
 example working with the MIN/MAX variables, do you have a sample command?
 
 The one from documentation does not work? What is wrong?

The documentation examples use min and max but not the MIN and MAX variables.
Dave
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


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

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


[...]


 I re-tested and all looks great. The new default size, 900x256, makes sense
 and I'm glad to see it now works with audio metadata (would love to be able
 to use astats with this someday). I'm having a little trouble getting an
 example working with the MIN/MAX variables, do you have a sample command?

The one from documentation does not work? What is wrong?

 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 (a)drawgraph filter

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

 On Jun 29, 2015, at 2:09 PM, Paul B Mahol one...@gmail.com wrote:

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


 [...]


 I re-tested and all looks great. The new default size, 900x256, makes
 sense
 and I'm glad to see it now works with audio metadata (would love to be
 able
 to use astats with this someday). I'm having a little trouble getting an
 example working with the MIN/MAX variables, do you have a sample
 command?

 The one from documentation does not work? What is wrong?

 The documentation examples use min and max but not the MIN and MAX
 variables.

signalstats,drawgraph=lavfi.signalstats.SATAVG:'if(between(VAL, MIN,
MIN + 20),0xff,0xff00)':min=0:max=255
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel