It's not a good idea to mix input and output options. Hopefully, you'll notice that avconv is converting your audio to Vorbis rather than FLAC - that's because it thinks you're trying to set that as the audio codec of your video4linux device, and is ignoring it as an invalid option. You'd also be best served using x264 as your video encoder. Since you're using Ubuntu, IIRC you should have it as a part of ubuntu-restricted-extras.
avconv -f alsa -i default -f video4linux2 -r 6 -i /dev/video0 -f x11grab -i 0:0 \ -map 1 -map 2 -map 0 \ -c:a flac -c:v libx264 -crf 23 -preset veryfast output.mkv
By default, avconv selects only one video stream and one audio stream (and one subtitle stream if there's one there) to output. -map 1 -map 2 -map 0
tells it to take every stream from the first three inputs (it starts counting from 0).
It's not directly relevant to this (since each of your inputs will contain only one stream), but you can also select individual streams from inputs with -map
: -map 0:1
will map the second stream from the first audio, -map 1:a
will map every audio stream from the second input, -map 2:v:1
will map the second video stream from the third input and -map 3:s
will map all the subtitles from the fourth input.
The order in which you use the -map
flags matters; in the example above, I've made it so that the audio input is mapped third, by placing that -map
last.
If you have problems with x264 slowing down your screen recording (it shouldn't unless you have a borderline-obsolete computer), you can try changing the -preset
to superfast or ultrafast, both of which will give you faster/less-CPU-intensive encoding If that doesn't work, you could try using -c:v huffyuv
- that's a lossless video codec, the video equivalent of FLAC, and will give you truly ludicrous file sizes; but you can re-encode to a less painfully big codec later.