[FFmpeg-devel] [PATCH] lavfi: add audio eval signal source

Stefano Sabatini stefasab at gmail.com
Sun Oct 16 14:59:23 CEST 2011

On date Sunday 2011-10-16 12:09:03 +0200, Nicolas George encoded:
> Le quartidi 24 vendémiaire, an CCXX, Stefano Sabatini a écrit :
> > Extended. I opted for the syntax:
> > expr1|expr2|...|exprN:opts
> > 
> > Assumptions: ":" and "|" must not appear in the expressions.
> I like Michael's suggestion slightly better: expr1:expr2::opts.

Updated to support this syntax.
> > $ ffplay -f lavfi "aevalsrc=abs(sin(1/10*2*PI*t))*sin(440*2*PI*t)|(1-abs(sin(1/10*t*2*PI)))*sin(450*2*PI*t + PI*sin(2*PI*t)), aconvert=s16:stereo:packed"
> > 
> > note that the aconvert=s16:stereo:packed is (unfortunately) required
> > or there will be a conversion to mono, as the auto-inserted aconvert
> > merges all the formats supported by aconvert with the output filter
> > formats, and this is done *before* to merge the formats supported by
> > aevalsrc and aconvert (but I'm thinking to add a new aconvert mode for
> > forcing aconvert to use the same input formats whenever it's
> > possible).

> I am not sure I understand exactly the problem, but it looks like a serious
> misfeature. Why does the auto-inserted aconvert squish this particular case
> of stereo, and not all stereo files?

It's not related to a particular chlayout, but depends on how aconvert
works. af_aconvert.c/query_formats() will merge all the supported
output formats with the formats supported by the output filter,
disregarding the input formats - this is the same logic adopted by the
video convert/scale - but it doesn't work so well with audio as even
if you don't have sample formats in common you may still want to avoid
to convert packing format/channel layout.

As I said, fixing this is high in my todo priority list.

> > + at item
> > +Generate two signals in the left and right channel:
> > + at example
> > +aevalsrc=sin(440*2*PI*t)|sin(450*2*PI*t + PI*sin(2*PI*t))
> > + at end example
> Maybe a more practically useful example:
> + at item
> +Generate 2.5 Hz binaural beats on a 360 Hz carrier:
> + at example
> +aevalsrc=0.1*sin(2*PI*(360-2.5/2)*t) | 0.1*sin(2*PI*(360+2.5/2)*t)
> + at end example

> (one day, I'll try to rewrite sbagen as a ffmpeg format/codec...)
> Apart from that, it looks really fine.

If I read no more comments, I'll push the patch after the av_strtok()
one (on which this one seems to depend).
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-lavfi-add-audio-eval-signal-source.patch
Type: text/x-diff
Size: 10681 bytes
Desc: not available
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20111016/559a5e25/attachment.bin>

More information about the ffmpeg-devel mailing list