Can we use FFmpeg to do any additional processing?
Can we add command line executions on specific conditions (like running a script when the server receives a stream or running a script when the stream finishes etc.)?
Yes, you can. Please see our blog.
Additionally, you should look at Creating Your First Red5 Application. Then you can look at overwriting the streamBroadcastClose method in your custom ApplicationAdapter class. Using Java’s Runtime class you can call FFMPEG to make the conversion.