http://sonnati.wordpress.com/2012/07/02/ffmpeg-the-swiss-army-knife-of-internet-streaming-part-v/
"5. Record a stream endlessly rotating target file"
That handles your circular buffer.
You might have to do a little experimenting to see what works for you to get the previous 30 seconds. There are a number of ways to do that so it'll be up to the implementer.