mkfifo video.pipe mkfifo audio.pipe mkfifo audio2.pipe mkvmerge -o 66.mkv video.pipe audio2.pipe & mencoder 66.mpg -nosound -ovc lavc -lavcopts vcodec=mpeg4:vbitrate=1500:mpeg_quant:autoaspect -o video.pipe & oggenc -b 160 -o audio2.pipe audio.pipe & mplayer -vc null -vo null -ao pcm:fast:file=audio.pipe 66.mpg & wait # Or if mkvmerge won't take pipes, use these mencoder 66.mpg -nosound -ovc lavc -lavcopts vcodec=mpeg4:vbitrate=1500:mpeg_quant:autoaspect -o tempvideo.avi & oggenc -b 160 -o tempaudio.ogg audio.pipe & mplayer -vc null -vo null -ao pcm:fast:file=audio.pipe 66.mpg & wait mkvmerge -o 66.mkv tempvideo.avi tempaudio.ogg