-
Hello, I'm currently working on my course project in university and my goal is to write simple rtsp proxy with error-prone client. Generally speaking I have a ip-cam with rtsp stream in lecture room and ffmpeg-based scheduled scripts somewhere to save lecture record. But due to network issues sometimes camera is unavailable which causes ffmpeg to throw an error. I want to put a proxy between camera and client, and when network error occurs send some picture with "please stand by". I'm not that familiar with network programming and RTSP protocol, but can I just catch error after play request and directly write packets to ServerStream? Or is there some way to do it more clearly?
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
Hello, this task is difficult since it involves creating a continuous and coherent H264 stream (assuming your camera uses H264 as its video codec). The RTSP protocol only implements the outer layer that wraps the H264 stream. When a camera disconnects, the H264 stream goes missing and it's impossible to recreate it or insert frames in between. The easiest way i can think of implementing this consists in:
|
Beta Was this translation helpful? Give feedback.
Hello, this task is difficult since it involves creating a continuous and coherent H264 stream (assuming your camera uses H264 as its video codec). The RTSP protocol only implements the outer layer that wraps the H264 stream. When a camera disconnects, the H264 stream goes missing and it's impossible to recreate it or insert frames in between.
The easiest way i can think of implementing this consists in:
Connect to the stream, start decoding H264 access units:
https://github.com/bluenviron/gortsplib/blob/main/examples/client-read-format-h264/main.go
Create a server that encodes the H264 access units and makes them available to any client:
https://github.com/bluenviron/gortsplib/blob/m…