Sign up ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It's 100% free, no registration required.

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
share|improve this question

1 Answer 1

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.

share|improve this answer
I'll try this as soon as I can but with your description it seem to be what I need, are the source always in sync ? – eephyne Jul 17 '14 at 7:13
Any time you merge separate files without timing info, there is no explicit synchronisation and so results may vary. If the files are in sync to start with then they should stay roughly in sync; if the microphone audio starts at different time to the screen capture then you may need to crop or pad it first. It is easiest if your recording method captures all the inputs starting at the same time. – Colin Phipps Jul 17 '14 at 8:34
Yeah sure I need to sync when merging them it's kind of obvious, My concern was most about "recording distortion" of one or another of the streams. – eephyne Jul 17 '14 at 13:04

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.