You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Support RTSP + RTCP + RTP + FMP4 protocol data parsing.
Support H264 video stream parsing, mainly for cameras.
Support TCP/UDP transport protocol.
Pure JAVA development, without any other dependencies, lightweight.
Fast and low latency, out of the box.
Example
The default mode is TCP. You can also use UDP.
Support username and password authentication.
1. RtspClient
publicclassRtspTcpNoAuthenticator {
publicstaticvoidmain(String[] args) {
// rtsp address of cameraURIuri = URI.create("rtsp://127.0.0.1:8554/11");
// create the RTSP client instance, noAuthenticator + TCPRtspClientclient = newRtspClient(uri);
// set the RTSP interactive process information to print. If it is not required, do not set it.client.onCommCallback(System.out::println);
// set the received video data frame eventclient.onFrameHandle(x -> {
H264VideoFramef = (H264VideoFrame) x;
System.out.println(f.getFrameType() + ", " + f.getNaluType() + ", " + f.getTimestamp() + ", " + f.getFrameSegment().length);
});
client.onDestroyHandle(() -> System.out.println("close"));
// closed asynchronously, written before startup because it is a test exampleCompletableFuture.runAsync(() -> {
try {
TimeUnit.SECONDS.sleep(3);
} catch (InterruptedExceptione) {
thrownewRuntimeException(e);
}
client.stop();
});
// start, return asynchronous futureCompletableFuture<Void> future = client.start();
// loop wait endwhile (!future.isDone()) {
try {
TimeUnit.SECONDS.sleep(1);
} catch (InterruptedExceptione) {
thrownewRuntimeException(e);
}
}
}
}