Add the code below to your Application class in your red5 app. It has the codes to start recording, save the recording to the disk and stop.
/*
*Start the recording
*/
public void recordVideo() {
IConnection conn = Red5.getConnectionLocal();
//get the stream published by the id "publishId"
ClientBroadcastStream stream = (ClientBroadcastStream) getBroadcastStream(conn.getScope(), "publishId");
try {
// Save the stream to disk.
stream.saveAs("streamName", false);
} catch (Exception e) {
throw new RuntimeException(e.getMessage());
}
}
/*
*Stop the recording
*/
public void stopRecording(){
IConnection conn = Red5.getConnectionLocal();
ClientBroadcastStream stream = (ClientBroadcastStream) getBroadcastStream(conn.getScope(), "publishId");
// Stop recording.
stream.stopRecording();
stream.stop();
}
JUV RTMP is a java client for RTMP protocol. But it doesn't offer any codec for audio/video streaming:
Play and publish audio/video streams (supported by the server) (!audio/video codec implementations are not included!)