Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Question: keeping client connections alive after input stream interruptions #672

Open
derSoerrn95 opened this issue Dec 30, 2024 · 0 comments

Comments

@derSoerrn95
Copy link

derSoerrn95 commented Dec 30, 2024

Description:
I'm new to RTSP and streaming. I’ve tried the server example in the gortsplib repo (https://github.com/bluenviron/gortsplib/blob/main/examples/server/main.go), but the clients get terminated when the input stream ends. My application already automatically restarts the FFmpeg process that sends the RTSP input stream.

I think it's because the sh.stream.Close() when a new stream is announced what happens, when I'm restarting my ffmpeg input process.

I would like to build a RTSP server that:

  • Receives an RTSP stream from an FFmpeg process.
  • Allows multiple FFmpeg clients to connect and receive the stream.
  • Keeps the FFmpeg clients connected even if the input stream is interrupted (e.g., network failure or FFmpeg process termination).
  • Automatically resumes feeding the stream to clients once the input stream is restored without requiring clients to reconnect.

Example FFmpeg processes:

  1. Input FFmpeg process (sending to RTSP server):
    ffmpeg -i input_stream_url_cameraX -c:v copy -c:a copy -f rtsp rtsp://localhost:8554/{{ cameraX }}/stream
  2. Client FFmpeg process (receiving from RTSP server and outputting to another stream):
    ffmpeg -i rtsp://localhost:8554/{{ cameraX }}/stream -c:v libx264 -c:a aac -f flv rtmp://cameraX/stream

Questions:

  • Is this possible with gortsplib?
  • How can I maintain the connection to the clients when the ffmpeg process that sends the input stream is restarted?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant