Confused about ffmpeg / rtsp-simple-server interaction #298
Replies: 2 comments 3 replies
-
Hello, rtsp-simple-server is a live media server - it accepts published streams at any time, independently from how many clients are connected, and sends the streams exclusively to readers that request it. It's like the "live" mode of YouTube - a person can publish a live feed at any time, it's of no importance the fact that someone is watching it - but at any time, 1, 2, a thousand clients can connect and receive the stream. In your case specific, the published video frames get lost, until someone starts reading them. |
Beta Was this translation helpful? Give feedback.
-
So you're saying that once ffmpeg is launched, it will start streaming the video, regardless as to whether anyone is watching, and then ffmpeg should stop when the video file is finished streaming. The problem is that ffmpeg never stops. It keeps streaming and streaming long after the video file should be finished. So what exactly is ffmpeg streaming? |
Beta Was this translation helpful? Give feedback.
-
Which version are you using?
v0.15.0
Question
I'm confused about the interaction between ffmpeg and rtsp-simple-server. I'm trying to create a personal "mini YouTube". That is, I have a bunch of MP4 files on a Raspberry Pi, and I want to be able to stream any of those files to any web browser.
I'm following the example specified in the README. I launch rtsp-simple-server:
./rtsp-simple-server
2021/03/22 07:24:04 [I] [0/0/0] rtsp-simple-server v0.15.0
2021/03/22 07:24:04 [I] [0/0/0] [RTSP/UDP/RTP listener] opened on :8000
2021/03/22 07:24:04 [I] [0/0/0] [RTSP/UDP/RTCP listener] opened on :8001
2021/03/22 07:24:04 [I] [0/0/0] [RTSP/TCP listener] opened on :8554
2021/03/22 07:24:04 [I] [0/0/0] [RTMP listener] opened on :1935
2021/03/22 07:24:12 [I] [1/0/0] [client 192.168.1.4:34256] connected (RTSP/TCP)
and then in another session, I launch ffmpeg:
ffmpeg -re -stream_loop -1 -i ~pi/sample-mp4-file.mp4 -c copy -f rtsp rtsp://localhost:8554/mystream
What confuses me is that it appears that ffmpeg starts streaming the MP4 file to rtsp-simple-server, even though there is no web browser connected:
Stream mapping:
Stream #0:0 -> #0:0 (copy)
Stream #0:1 -> #0:1 (copy)
Press [q] to stop, [?] for help
frame= 958 fps= 15 q=-1.0 size=N/A time=00:01:03.82 bitrate=N/A speed= 1x
The 'frame' and 'time' fields keep increasing, as if it were actually streaming the MP4 file to .... somewhere?
What is ffmpeg doing right now? When I start it, I see this in the rtsp-simple-server console:
2021/03/22 07:26:19 [I] [2/0/0] [client [::1]:59752] connected (RTSP/TCP)
2021/03/22 07:26:19 [I] [2/1/0] [client [::1]:59752] is publishing to path 'mystream', 2 tracks with udp
Beta Was this translation helpful? Give feedback.
All reactions