[FFmpeg-user] Generating Multichannel Sine Wave Audio
Moritz Barsnick
barsnick at gmx.net
Mon Dec 12 23:13:13 EET 2016
On Mon, Dec 12, 2016 at 20:37:03 +0000, Matthias, Thomas wrote:
> I see that there is a sine wave filter when using ‘-f lavfi –i
> “sine=frequency=1000:duration=60”, which is great! However, what is
> the easiest/best way to get this into a multichannel format, say 5.1
> or even 16 channels? Ideally it would be nice to specify multiple
> frequencies for each channel, but if I want say 16 channels of the
> exact same sinewave in each, how would I do this? Is there a way to
> “copy” the first channel into the remaining 15? Do I need to specify
> an input for each channel and then use –map correctly?
All your suggestions are basically correct. Perhaps the magic bit you
are missing is the "amerge" filter.
Firstly, if you want to duplicate the same input, you can reuse it with
filter_complex:
$ ffmpeg -f lavfi -i sine -filter_complex "[0][0][0][0][0][0]amerge=inputs=6" -t 1 -f ipod /dev/null -y
For differing frequencies, you can just as well add various input sources:
$ ffmpeg -f lavfi -i sine=f=440 -f lavfi -i sine=f=880 -filter_complex "[0][1]amerge" -t 1 -f ipod /dev/null -y
(These are somewhat shorthand filter_complex usages, missing an output
pad "[out]" and mapping '-map "[out]"'.)
You can find some more mapping inspiration (minus the duplicated audio
sources) here:
https://trac.ffmpeg.org/wiki/AudioChannelManipulation
Cheers,
Moritz
More information about the ffmpeg-user
mailing list