[FFmpeg-devel] [WIP] lavfi: add showaudio filter

Clément Bœsch ubitux at gmail.com
Tue Dec 27 20:15:34 CET 2011


On Tue, Dec 27, 2011 at 07:20:04PM +0100, Stefano Sabatini wrote:
> On date Tuesday 2011-12-27 14:58:03 +0100, Stefano Sabatini encoded:
> > On date Monday 2011-12-26 00:14:39 +0100, Stefano Sabatini encoded:
> > > Subject: [PATCH] lavfi: add showaudio filter
> > > 
> > > ---
> > >  libavfilter/Makefile        |    3 +-
> > >  libavfilter/allfilters.c    |    3 +
> > >  libavfilter/avf_showaudio.c |  174 +++++++++++++++++++++++++++++++++++++++++++
> > >  3 files changed, 179 insertions(+), 1 deletions(-)
> > >  create mode 100644 libavfilter/avf_showaudio.
> > 
> > Main problem is now to understand how to visualize N samples in a
> > packet using only w columns.
> > 
> > One possibility: w defines the number of samples to visualize, this
> > means that we have to visualize samplerate/w frames, i.e.:
> > rate = samplerate/w
> > 
> > For example with w=640, samplerate=22100:
> > rate = 22100/640 ~= 35
> > 
> > Alternatively I could fix the rate, and scale the image accordingly by
> > imposing:
> > samples_to_show = samplerate / rate
> > 
> > For example with rate = 10, samplerate = 22100
> > samples_to_show = 22100 / 10 = 2210
> > 
> > and I could use lsws to scale such an image to make it suit w.
> 
> Updated implementing the first option.
> Still missing:
> * multiple channels support, every channel may be displayed on a
>   separate area a-la ffplay or on the same area, possibly letting the
>   user choose the color for each channel wave.
> 
> > RDFT should be easier to add (same for some power/volume
> > visualization).
> 
> Due to different caching logic this could be a separate filter
> (e.g. showaudio -> showwaves, showrdft?).
> 

Sounds like a good idea; if you want to continue on showaudio, I'd like to
do the showrdft/spectrum one, so we could replace the ffplay builtin with
this filter.

> > For more complex audio visualizations we may consider to write a
> > MilkDrop/ProjectM wrapper.
> 
> Started to look at this, it's quite complex due to the use of C++ and
> to the opaque API (I can't still guess how to just get the video data
> out of the SDL/GL mess). Hints are welcome if you have experience with
> it (IIRC at least VLC has/planned to have a projectm wrapper, don't
> know how it ended).

The get_screenshot function in mplayer2 might give you some hints:
http://git.mplayer2.org/mplayer2/tree/libvo/vo_gl.c#n1127

Also, maybe the other plugins such as XMMS one should give an overview of
the API usage.

Anyway, I think an example like "amovie=a.mp3,asplit[a][out1];
[a]showaudio[out0]" in the documentation will be welcome when adding this
first filter.

[...]

-- 
Clément B.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 490 bytes
Desc: not available
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20111227/b5218446/attachment.asc>


More information about the ffmpeg-devel mailing list