Xuggler is a nice opensource Java library that deals with streaming and modifying media on the fly.
http://www.xuggle.com/xuggler/
You can either use it with Red5 or if you want complete control, Xuggler has an IContainer class where each instance can be set up to stream media in or out. I've been able to restream media over UDP and TCP/IP.
Also, Xuggler will automatically split various streams for you to analyze/modify (video, audio, metadata) and is built using FFMPEG (tons of out of the box codecs) =).
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…