i have a example command and config for motion using the parameter "extpipe":
 (requires latest motion (from svn or a git repo) and ffmpeg)

> Date: Sun, 13 Oct 2013 06:39:28 +0300
> From: sss@sss.chaoslab.ru
> To: motion-user@lists.sourceforge.net
> Subject: [Motion-user] encoding video to high compression format
> Good day, i have feature request, it will be good to have ability to
> encode videos to h264/vp8, is it hard to implement this ?, as i know
> motion using ffmpeg as encoding backend, so i guess what it must be not
> to hard to implement other codecs supported by ffmpeg ?
> ------------------------------------------------------------------------------
> October Webinars: Code for Performance
> Free Intel webinars can help you accelerate application performance.
> Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from
> the latest Intel processors and coprocessors. See abstracts and register >
> http://pubads.g.doubleclick.net/gampad/clk?id=60134071&iu=/4140/ostg.clktrk
> _______________________________________________
> Motion-user mailing list
> Motion-user@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/motion-user
> http://www.lavrsen.dk/twiki/bin/view/Motion/WebHome