On Tue, Dec 13, 2011 at 05:08:26PM +0100, Nicolas George wrote:
Le tridi 23 frimaire, an CCXX, Matthieu Bouron a écrit :
Hi there,
Here is a first attempt to write an audio filter which merge two audio streams. Usage is: ffplay -f lavfi "amovie=test1.mp3[a];amovie=test2.mp3[b];[a][b]mix=0.7:0.3[out]"
The volume of each streams can be configured and default to 0.5:0.5 is not specified. It only support two s16 audio streams with same sample rate. Feel free to comment.
This is a much asked for feature, but I do not like the design you adopted. I think your version is confusing two different tasks: merging the streams, and mixing the channels with configurable coefficients. Thus, it only satisfies the most basic needs.
I believe that it is better to separate both tasks: first merging a n-channels streams and a p-channels streams into a stream with n+p channels, and then mixing the channels together if necessary.
I think this might get complicated with amerge+pan for the user... This filter is IMO a really user friendly way to do a pretty common operation: add a background music to a video. Just like we can use af pan to downmix from 5.1 to stereo, having a "-ac 2" option is a nice have.
For the first task, I started some time ago a "amerge" filter. The work as I left it is there: http://ffmpeg.org/pipermail/ffmpeg-devel/2011-November/116523.html I intend to start working on it again soon.
Heh, I was just testing it again today :) Unfortunately I got issues, I'm looking forward the next version. So to sum up, I think this filter is pretty useful and might just be the "easy way" for basic and common mixing usage. -- Clément B.