I am trying to save live stream with this example. I am working on localhost for testing and Red5 version is 1.0.
streamPublishStart
method receives stream, saves it as flv with saveAs
method. But my recorded flv files are only 1 frame (not second, checked with GOM Player). But if i attach a listener to stream and check received packages, i can see they are keep coming.
This is how i tested it;
public void streamPublishStart(IBroadcastStream stream) {
try {
stream.addStreamListener(new IStreamListener() {
@Override
public void packetReceived(IBroadcastStream streamObj, IStreamPacket packet) {
System.out.println(packet.getTimestamp() + " - " + packet.getDataType());
}
});
stream.saveAs(stream.getPublishedName(), false);
} catch (Exception e) {
e.printStackTrace();
}
}
This code printed timestamps until i stopped recording. I tried to save these bytes from received packages and merge them with file saveAs
method created, nothing happened.
What can be the problem? Any suggestions?
I downgrade to Red5 0.8.0 Final, Java 6 and used SimpleRecorder example, it worked.
I couldn't find the source of oflaDemo but you can convert classes to .java files with JD java decompiler
oflaDemo classes are in the webapps/oflaDemo/WEB-INF/classes
directory after you install it from installer.
It is not an actual answer but this will stay as right answer until a better one appears.