How to merge two audio input source using avconv

audioavconvinput

I try to make screencast using avconv and I facing a problem.
I finally succeed to record both pc output and microphone input , the problem is that they're not merged in the output file.
(I saw they're an option filter_complex amix=inputs but its only in early release)

Is there any other way i can merge them (even if it's post production i don't care)

here the command line i use

avconv -f alsa -ac 2 -i pulse -f alsa -ac 2 -i hw:2,0 -filter_complex amix=inputs=2 -f x11grab -r 30 -s 1366x742 -i :0.0+1369,25 -map 0:0 -map 1:0 -map 2:0 -acodec flac -vcodec libx264 -preset:v superfast -crf 18 -threads 0 output.mkv

Best Answer

I routinely do this with ffmpeg, which has similar filters—so maybe this helps you. This assumes screen capture & pc audio in screen.avi, microphone capture in mic.wav.

ffmpeg -i screen.avi -i mic.wav -filter_complex '[0:1][1:0]amix=inputs=2:duration=first[all_audio]' -map 0:0 -map '[all_audio]' -vcodec libx264 -crf 28 -preset slow -acodec mp3 out.avi

I think -map picks channels to go into the output, so if I was debugging your original command line, I think you should lose -map 1:0 -map 2:0 (which is mapping the unmerged inputs into your output) and should instead name the output of the amix plugin (for instance to all_audio as in my example) and have a -map '[all_audio]' (to map the merged audio into your output). But I do not know avconv.

Related Question