As you want video and audio in your pipeline, it is going to be a little complicated (I thought a little pic might help):
To keep the gst-launch command as clear as possible, I put each linear pipeline piece into one command line (the red connections in the first line, then the blue, the green and yellow ones and finally the queueing stuff which is colored black in the above picture):
gst-launch-0.10 v4l2src ! videorate ! videoscale ! x264enc ! tee name=videoTee \
pulsesrc ! ffenc_aac ! tee name=audioTee \
flvmux name=flvMux ! filesink location=/tmp/foo.flv \
matroskamux name=mkvMux ! filesink location=/tmp/foo.mkv \
audioTee. ! queue ! flvMux. \
audioTee. ! queue ! mkvMux. \
videoTee. ! queue ! flvMux. \
videoTee. ! queue ! mkvMux.
Just one last note: I tried it using lame
instead of ffenc_aac
as I don't have it installed, but it should work with both of them.
Edit: Completely rewrote the answer including audio support, added a pipeline pic (the pic btw. was made using the awesome GraphViz tool).